I have a Array like this
Array
(
[0] => Array
(
[vendor_id] => 2
[vendor_total_order] => 80
)
[1] => Array
(
[vendor_id] => 2
[vendor_total_order] => 100
)
[2] => Array
(
[vendor_id] => 1
[vendor_total_order] => 150
)
[3] => Array
(
[vendor_id] => 3
[vendor_total_order] => 80
)
[4] => Array
(
[vendor_id] => 5
[vendor_total_order] => 150
)
[5] => Array
(
[vendor_id] => 1
[vendor_total_order] => 110
)
)
I want to simplify this array in such a way that if the 'vendor_id' are same for two values there there accumulated/summed value should be assigned to 'vendor_total_order' to that 'vendor_id'(basically we are removing values which are having same vendor_id with the total value of duplicates).
So when i provide the above array as input the output should look like as follow
Array
(
[0] => Array
(
[vendor_id] => 2
[vendor_total_order] => 180
)
[1] => Array
(
[vendor_id] => 1
[vendor_total_order] => 260
)
[2] => Array
(
[vendor_id] => 3
[vendor_total_order] => 80
)
[3] => Array
(
[vendor_id] => 5
[vendor_total_order] => 150
)
)
How can i do this ?