I have two array.
first array store in $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
)
)
)
)
)
second array store in $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
)
)
now if first array compare with second array.depend on given example
here first array first index id 1 match with second array [0] and [1] so from first array this list item will be deleted .also other like same.
after calculation output will be
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
)
)
)
)
)
I am confused how can i calculate it.
I want if any list_id($array2) match with first array checking every item [id] then delete ($array1) [item_list] array item match with [item_id] corresponding [list_id] () from matched item [id] of first array.
Please compare my given expected result array with given $array1 and $array2