diff()
The diff() method compares with other arrays and returns the values that are not in any of the other arrays
<?php use kim\present\utils\arrays\ArrayUtils;
$arrayUtils = ArrayUtils::from(["first", "second", "third"]);
//General array comparison
$arrayUtils->diff(["first", "4th"]);
// expected output: ["second", "third"]
Syntax
$arrayUtils->diff(iterable ...$iterables) : ArrayUtils;
Parameter
$iterables
Arrays to compare.
Return value
A array containing all the entries that are not present in any of the other arrays. (Keys are preserved)
Prefixing
$arrayUtils->diffAs(iterable ...$iterables) : array;
ArrayUtils::diffFrom(iterable $from, iterable ...$iterables) : ArrayUtils;
ArrayUtils::diffFromAs(iterable $from, iterable ...$iterables) : array;
References
Last updated