// array_diff_uassoc 用于多维数组
$color_1=array('a'=>'white','b'=>'red','c'=>array('a'=>'green','b'=>'blue','c'=>'yellow'));
$color_2=array('a'=>'white','b'=>'red','c'=>array('a'=>'white','b'=>'red','c'=>'yellow'));
function key_compare($a,$b){
if($a===$b) return 0;
return($a>$b)?1:-1;
}
print_r(array_diff_uassoc($color_1['c'], $color_2['c'],"key_compare"));
// 输出
数组
(
[a] => green
[b] => blue
)