I’ve got the following Php script:
<?php
function filt($k, $l){
if($k===$l){
var_dump("valid: ".$k."-".$l);
return 0;
}
return 1;
}
$a6=array(7, 9, 3, 33);
$a7=array(2, 9, 3, 33);
$u=array_udiff($a6, $a7, "filt");
var_dump($u);
?>
With the following output:
string 'valid: 3-3' (length=10)
array
0 => int 7
1 => int 9
3 => int 33
As I know, the array_udiff should dump the equal values and let only the different values from the first array.
What seems to be the problem here?
I run WampServer Version 2.2 on Windows 7. Php version: 5.3.9.
you’re not returning all necessary values (e.g. -1, 0, 1). See: array_udiff