$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 )