Source Code:
(back to article)
<?php function compare_values($a, $b) { if ($a === $b) { return 0; } return ($a > $b) ? 1 : -1; } function compare_keys($a, $b) { if ($a === $b) { return 0; } return ($a > $b) ? 1 : -1; } $array1 = array('a' => 'apple', 'b' => 'banana', 'c' => 'cherry', 'd' => 'durian'); $array2 = array('a' => 'apple', 'b' => 'game', 'c' => 'cherry'); $array3 = array('a' => 'apple', 'b' => 'door', 'c' => 'cherry', 'g' => 'durian'); $result = array_udiff_uassoc($array1, $array2, $array3, 'compare_values', 'compare_keys'); print_r($result); ?>
Result:
Report an issue