array_udiff_assoc

It finds the difference of arrays with additional index check, compares data by a callback function

Example

<?php
function func($arg1,$arg2)
{
if ($arg1===$arg2)
{
return 0;
}
return 1;
}
echo “<pre>”;
$array1=array(“a”=>”PHP”,”b”=>”JSP”,”c”=>”ASP”);
$array2=array(“a”=>”PHP”,”b”=>”AS”,”c”=>”JS”);
print_r(array_udiff_assoc($array1,$array2,”func”));
?>

Output

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

Share