我有两个数组。
$ array1中的第一个数组存储;
Array
(
[status] => 0
[message] => Already In List
[result] => Array
(
[0] => Array
(
[id] => 1
[name] => sazib
[list_status] => sync
[item_list] => Array
(
[0] => Array
(
[id] => 1
[name] => item1
[picture] => 1409220406-apple.png
[purchase_status] => no
[total_quantity] => 7
)
[1] => Array
(
[id] => 2
[name] => item1
[picture] =>
[purchase_status] => no
[total_quantity] => 3
)
[2] => Array
(
[id] => 3
[name] => item1
[picture] =>
[purchase_status] => no
[total_quantity] => 3
)
[3] => Array
(
[id] => 5
[name] => item1
[picture] =>
[purchase_status] => no
[total_quantity] => 4
)
[4] => Array
(
[id] => 6
[name] => item1
[picture] =>
[purchase_status] => no
[total_quantity] => 4
)
[5] => Array
(
[id] => 37
[name] => item1
[picture] =>
[purchase_status] => no
[total_quantity] => 4
)
)
)
[1] => Array
(
[id] => 3
[name] => sazib
[list_status] => sync
[item_list] => Array
(
[0] => Array
(
[id] => 10
[name] => test
[picture] =>
[purchase_status] => no
[total_quantity] => 3
)
[1] => Array
(
[id] => 11
[name] => prime
[picture] =>
[purchase_status] => no
[total_quantity] => 1
)
)
)
)
)
$ array2中的第二个数组存储
Array
(
[0] => Array
(
[id] => 1
[list_id] => 1
[item_id] => 3
)
[1] => Array
(
[id] => 2
[list_id] => 1
[item_id] => 5
)
[2] => Array
(
[id] => 3
[list_id] => 3
[item_id] => 11
)
)
现在,如果第一个数组与第二个array.depend比较给定的例子
这里第一个数组第一个索引id 1匹配第二个数组[0]和[1]所以从第一个数组开始,这个列表项将被删除。还有其他类似的。
计算输出后
Array
(
[status] => 0
[message] => Already In List
[result] => Array
(
[0] => Array
(
[id] => 1
[name] => sazib
[list_status] => sync
[item_list] => Array
(
[0] => Array
(
[id] => 1
[name] => item1
[picture] => 1409220406-apple.png
[purchase_status] => no
[total_quantity] => 7
)
[1] => Array
(
[id] => 2
[name] => item1
[picture] =>
[purchase_status] => no
[total_quantity] => 3
)
[2] => Array
(
[id] => 3
[name] => item1
[picture] =>
[purchase_status] => no
[total_quantity] => 3
)
[4] => Array
(
[id] => 6
[name] => item1
[picture] =>
[purchase_status] => no
[total_quantity] => 4
)
)
)
[1] => Array
(
[id] => 3
[name] => sazib
[list_status] => sync
[item_list] => Array
(
[0] => Array
(
[id] => 10
[name] => test
[picture] =>
[purchase_status] => no
[total_quantity] => 3
)
)
)
)
)
我很困惑如何计算它。
我希望任何list_id($ array2)匹配第一个数组检查每个项[id]然后删除($ array1)[item_list]数组项匹配[item_id]对应[list_id]()来自匹配项[id]第一阵列。
请将给定的预期结果数组与给定的$ array1和$ array2
进行比较