I am sruggeling with the following issue. I have 2 csv files from 2 different suppliers. I want to add the stock of both supplyers to a new total array.
Here is the output of Array 1
Array
(
[0] => Array
(
[ARTNUMBER] => 12345
[STOCK] => 3
)
)
Here is the output of Array 2
Array
(
[0] => Array
(
[ARTNUMBER] => 12345
[STOCK] => 5
)
[2] => Array
(
[ARTNUMBER] => 23456
[STOCK] => 5
)
)
The new array should look like this:
Array
(
[0] => Array
(
[ARTNUMBER] => 12345
[STOCK] => 8
)
[2] => Array
(
[ARTNUMBER] => 23456
[STOCK] => 5
)
)
I would like to do 2 things:
- If the ARTNUMBER is in both arrays add them. (array 1 [ARTNUMBER] + array 2 [ARTNUMBER]
- If a ARTNUMBER from array 2 does not exist in array 1. Add it to the array.
Could someone please help me out how to do this?
(I am looking for the most simple way of doing this)