array_diff_assoc:同时根据数组键和值,计算数组的差集
程序员文章站
2022-04-06 10:17:42
...
跳至
$arr1 = ['a'=>'aaa','b'=>'bbb',1=>'1',2=>2]; $arr2 = ['a'=>'bbb','b'=>'ccc',2=>2]; $arr = array_diff_assoc($arr1,$arr2); echo ''; print_r($arr); result: Array ( [a] => aaa [b] => bbb [1] => 1 )