日期:2014-05-16 浏览次数:20493 次
$a = array(1,2,3,4,5);
$b = array(1,6,3,4,5);
echo "<pre>";
print_r(array_udiff($a,$b,function($a,$b){
return ($a === $b)? 0:1;
}));
Array
(
[0] => 2
)
Array
(
[0] => 1
[1] => 2
[2] => 3
[4] => 5
)
array_udiff($a, $b, function($a, $b){
if($a == $b) return 0;
return $a > $b ? 1 : -1;
})