I have two multidimensional arrays and I want the difference. For eg. I have taken two-dimensional two arrays below
$array1 = Array (
[a1] => Array
For multidimensional arrays, array_diff_assoc
works better than array_diff
in some cases. I had an issue with array_diff
where it was not able to differentiate between 1 or 0 as value ( perhaps some other index had same value ) so array_diff_assoc
solved it as it checks for indexes as well. Just for future users who might encounter the same issue.