Well, I must say , I am lost with a feeling that the operation should be fast enough so looking for a fast performing combine.
my array Looks like
Array
(
[0] => Array
(
[id] => 35
[item] => Ball Pen
[qty] => 1
[price] => 23
[total] => 23
)
[1] => Array
(
[id] => 34
[item] => Summer vest
[qty] => 1
[price] => 23
[total] => 23
)
[2] => Array
(
[id] => 34
[item] => Summer vest
[qty] => 3
[price] => 23
[total] => 69
)
)
And as output I want a sum of qty if the id is occurring more than once
Array
(
[35] => Array
(
[id] => 35
[item] => Ball Pen
[qty] => 1
[price] => 23
[total] => 23
)
[34] => Array
(
[id] => 34
[item] => Summer vest
[qty] => 4
[price] => 46
[total] => 92
)
)
Something like this should work
Here is a demo showing the correct output.
You can get the updated output with something like this: