Source Code:
(back to article)
<?php function key_compare_func($key1, $key2) { if ($key1 == $key2) return 0; else if ($key1 > $key2) return 1; else return -1; } $array1 = array('a' => 'green', 'b' => 'brown', 'c' => 'blue', 'red' => 3); $array2 = array('d' => 'green', 'b' => 'yellow', 'yellow' => 10, 'red' => 'game'); $result = array_intersect_ukey($array1, $array2, 'key_compare_func'); print_r($result); ?>
Result:
Report an issue