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