Skip to content

Kirby 5.0.4

$pages->intersects()

Checks if there is an intersection between the given collection and this collection

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

Parameters

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

Return type

bool

This method modifies the existing $pages object it is applied to and returns it again.

Parent class

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

Examples

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

if ($articles1->intersects($articles2) {
    // do something
};