Reference

Guide

$pages->intersection()

Returns a Collection with the intersection of the given elements

$pages->intersection(\Kirby\Toolkit\Collection $other): Kirby\Toolkit\Collection

Parameters

Name Type Default Description
$other Kirby\Toolkit\Collection

Return type

Kirby\Toolkit\Collection

Example

$articles1 = $page->children()->filterBy('tags', 'water', ',');
$articles2 = $page->children()->filterBy('tags', 'nature', ',');

$intersection = $articles1->intersection($articles2);
dump($intersection);

Inherited from

Kirby\Toolkit\Collection

Source code

kirby/src/Toolkit/Collection.php#L551