intersect()
The intersect() method computes the intersection with other arrays and returns the values that intersects with another array.
Example.php
<?php use kim\present\utils\arrays\ArrayUtils;
$arrayUtils = ArrayUtils::from(["first", "second", "third"]);
//General array comparison
$arrayUtils->intersect(["first", "third"]);
// expected output: ["first", "third"]
$arrayUtils->intersect(iterable ...$iterables) : ArrayUtils;
$iterables
Arrays to compare.
- A array containing all of the values that intersects with another array.
$arrayUtils->intersectAs(iterable ...$iterables) : array;
ArrayUtils::intersectFrom(iterable $from, iterable ...$iterables) : ArrayUtils;
ArrayUtils::intersectFromAs(iterable $from, iterable ...$iterables) : array;
Last modified 2yr ago