实例首页
自学教程
IT工具箱
源代码
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>PHP array_udiff() 实例 - 自学教程(runoops.com)</title> </head> <body> <?php function myfunction($a,$b) { if ($a===$b) { return 0; } return ($a>$b)?1:-1; } $a1=array("a"=>"red","b"=>"green","c"=>"blue"); $a2=array("a"=>"blue","b"=>"black","e"=>"blue"); $result=array_udiff($a1,$a2,"myfunction"); print_r($result); ?> </body> </html>
运行结果: