Skip to content

Kirby 5.0.4

$pages->intersection()

Returns a Collection with the intersection of the given elements

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

Parameters

Name Type Default
$otherrequired Kirby\Toolkit\Collection no default value

Return type

Kirby\Cms\Pages

This method does not modify the existing $pages object but returns a new object with the changes applied. Learn more →

Parent class

Kirby\Cms\Pages inherited from Kirby\Toolkit\Collection

Examples

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

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