我有两个这样的多维数组:
$original = Array (
[0] => Array
(
[time] => 1364690340
[memberid] => 90
[type] => single
)
[1] => Array
(
[time] => 1364690341
[memberid] => 92
[type] => fixed
)
[2] => Array
(
[time] => 1364690342
[memberid] => 96
[type] => single
)
)
第二个像这样
$new = Array (
[0] => Array
(
[time] => 1364825750
[memberid] => 90
[type] => single
)
[1] => Array
(
[time] => 1364825751
[memberid] => 92
[type] => single
)
[2] => Array
(
[time] => 1364825752
[memberid] => 96
[type] => single
)
[3] => Array
(
[time] => 1364825753
[memberid] => 111
[type] => single
)
)
我的问题是:我想根据 memberid 和 type 键在 $original 数组中搜索匹配项,如果 memberid 和 type 不一样 -> 我想从 $original 数组中删除该数组。因此,在这种情况下,我想将 [0] 数组和 [2] 数组保留在 $new 数组中,我具有与原始数组相同的 memberid 和相同类型,但我想删除 [1] 数组,因为 memberid 是相同的,但是类型不同。所以我最终的 $original 数组将如下所示:
$original = Array (
[0] => Array
(
[time] => 1364690340
[memberid] => 90
[type] => single
)
[1] => Array
(
[time] => 1364690342
[memberid] => 96
[type] => single
)
)