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