Does anybody know of an array diff implementation in PHP? I need to use this to develop a feature similar to the way stackexchange diffs tags.
Like the documentation says:
Compares array1 against one or more other arrays and returns the values in array1 that are not present in any of the other arrays.
For example:
$array1 = array("a" => "green", "red", "blue", "red");
$array2 = array("b" => "green", "yellow", "red");
$result = array_diff($array1, $array2);
Would end up with $result
containing only the value blue
, because it is only in one of the arrays.
Complete documentation here: http://php.net/manual/en/function.array-diff.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With