Reference

Guide

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

Return type

bool

Example

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

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

Inherited from

Kirby\Toolkit\Collection

Source code

kirby/src/Toolkit/Collection.php#L562