我有2個數組,例如PHP比較2個多維數組並刪除基於鍵值的重複
OldMembers:
Array (
[0] => Array
(
[time] => 1361612421
[memberid] => 90
)
[1] => Array
(
[time] => 1361614422
[memberid] => 96
)
[2] => Array
(
[time] => 1361617423
[memberid] => 108
)
)
和NewMembers
Array (
[0] => Array
(
[time] => 1361618411
[memberid] => 103
)
[1] => Array
(
[time] => 1361618443
[memberid] => 129
)
[2] => Array
(
[time] => 1361618463
[memberid] => 96
)
)
什麼是去除基於關鍵MEMBERID從NewMembers重複的最好方法?例如。在這種情況下,我需要從NewMembers中刪除第二個數組,因爲memberid 96已經在位置1上的OldMembers中存在...並且我只需要從NewMembers數組中刪除該實例?
嘗試'in_array'function併發布您的代碼,然後 – michi 2013-02-23 11:50:50