我有 2 个要比较的数组,然后收集差异。
我只在每个数组中显示 2 个元素。通常每个数组包含超过 80000 个元素
Array1 输出 ( $Memcooltransactions
)
Array (
[0] => Array ( [zipcode] => 0000 [city] => 23593 Vellinge, Sverige [numberofuniqmembers] => 11 [numberofuniqspisesteder] => 0
[1] => Array ( [zipcode] => 4212 [city] => CPH, Denmark [numberofuniqmembers] => 2 [numberofuniqspisesteder] => 0 )
Array1 输出 ( $result
)
Array (
[0] => Array ( [zipcode] => 0460 [city] => Nordskali, Færøerne [numberofuniqmembers] => 1 [numberofuniqspisesteder] => 0
[1] => Array ( [zipcode] => 4212 [city] => CPH, Denmark [numberofuniqmembers] => 2 [numberofuniqspisesteder] => 0 )
期望的输出:
[0] => Array ( [zipcode] => 0000 [city] => 23593 Vellinge, Sverige [numberofuniqmembers] => 11 [numberofuniqspisesteder] => 0
[1] => Array ( [zipcode] => 0460 [city] => Nordskali, Færøerne [numberofuniqmembers] => 1 [numberofuniqspisesteder] => 0
这就是我尝试的方式:
$result2 = array_diff_assoc($Memcooltransactions, $result1);
但我得到这个输出:($result2
)
Array (
[0] => Array ( [zipcode] => 0000 [city] => 23593 Vellinge, Sverige [numberofuniqmembers] => 11 [numberofuniqspisesteder] => 0
[1] => Array ( [zipcode] => 4212 [city] => CPH, Denmark [numberofuniqmembers] => 2 [numberofuniqspisesteder] => 0
[2] => Array ( [zipcode] => 0460 [city] => Nordskali, Færøerne [numberofuniqmembers] => 1 [numberofuniqspisesteder] => 0
)
为什么会这样?