array_diff_ukey

It computes the difference of arrays using a callback function on the keys for comparison

Example

<?php
function fun1($arg1, $arg2){
if ($arg1 === $arg2)     return 0;
return ($arg1 > $arg2)? 1:-1;
}
echo “<pre>”;
$array1 = array(“a” => “PHP”, “b” => “ASP”, “c” => “JSP”, “VB”);
$array2 = array(“a” => “PHP”, “ASP”, “JSP”);
$array3 = array_diff_ukey($array1, $array2, “fun1”);
print_r($array3);
?>

Output

Array
(
[b] => ASP
[c] => JSP
)

Share