Source Code:
(back to article)
<?php function compareArrays($a, $b) { if ($a === $b) { return 0; } return ($a > $b) ? 1 : -1; } $array1 = array("a" => "red", "b" => "green", "c" => "blue"); $array2 = array("a" => "red", "b" => "blue", "c" => "green"); $result = array_udiff_assoc($array1, $array2, "compareArrays"); print_r($result); ?>
Result:
Report an issue