array_udiff_uassoc

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

Example

<?php
function func1($arg1,$arg2)
{
if ($arg1===$arg2)
{
return 0;
}
return 1;
}

function func2($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_uassoc($array1,$array2,”func1″,”func2″));
?>

Output

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

Share