multidimensional array difference php

前端 未结 12 1149
离开以前
离开以前 2020-12-01 17:05

I have two multidimensional arrays and I want the difference. For eg. I have taken two-dimensional two arrays below

$array1 = Array (
       [a1] => Array         


        
12条回答
  •  独厮守ぢ
    2020-12-01 17:09

    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.

提交回复
热议问题