Skip to content

Kirby 3.7.5

$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
$other * Kirby\Toolkit\Collection

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

Example

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

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