diffKey()
The diffAssoc() method all similar to diff(), but this applies to keys
Example.php
<?php use kim\present\utils\arrays\ArrayUtils;
$arrayUtils = ArrayUtils::from(["first" => 1, "second" => 2, "third" => 3]);
//General array comparison
$arrayUtils->diffKey(["first" => 404, "second" => 404]);
// expected output: ["third" => 3]
$arrayUtils->diffKey(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->diffKeyAs(iterable ...$iterables) : array;
ArrayUtils::diffKeyFrom(iterable $from, iterable ...$iterables) : ArrayUtils;
ArrayUtils::diffKeyFromAs(iterable $from, iterable ...$iterables) : array;
Last modified 2yr ago