I have taken a long time researching how to perform this operation between arrays but I can not get an algorithm in PHP I return these results.
Array #1:
Array DB_ITEMS
(
[1] => Array
(
[item_code] => FO1321
[item_quantity] => 5
[item_sellprice] => 18.00
[found] => 0
)
[2] => Array
(
[item_code] => HE240
[item_quantity] => 1
[item_sellprice] => 22.40
[found] => 0
)
)
Array #2:
Array BUY_ITEMS
(
[1] => Array
(
[item_code] => FO1321
[item_quantity] => 1
[item_sellprice] => 18.00
[taken] => 0
)
[2] => Array
(
[item_code] => EL55
[item_quantity] => 1
[item_sellprice] => 8.00
[taken] => 0
)
)
I want this Result, in an Array Format:
Array FINAL_RESULT
(
[1] => Array
(
[item_code] => FO1321
[item_quantity] => -4
[item_sellprice] => 22.40
[taken] => 0
)
[2] => Array
(
[item_code] => HE240
[item_quantity] => -1
[item_sellprice] => 22.40
[taken] => 0
)
[3] => Array
(
[item_code] => EL55
[item_quantity] => +1
[item_sellprice] => 8.00
[taken] => 0
)
)
I'm doing this to compare an existing bill that is being modified. And I need to set the differences between them and then make changes in DB.