array_udiff

It finds the difference of arrays by using a callback function for data comparison

Example

<?php
function func1($v1,$v2)
{
if ($v1===$v2)
{
return 0;
}
return 1;
}
echo “<pre>”;
$array1=array(“a”=>”PHP”,”b”=>”JSP”,”c”=>”AS”);
$array2=array(1=>”PHP”,2=>”ASP”,3=>”JS”);
print_r(array_udiff($array1,$array2,”func1″));
?>

Output

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

Share