I have the following array:
[
['id' => 1, 'uid' => 50, 'sum1' => 1, 'sum2' => 2],
['id' => 2, 'uid' => 50, 'sum1' => 2, 'sum2' => 4],
['id' => 3, 'uid' => 51, 'sum1' => 3, 'sum2' => 5],
]
As you can see, on some of those indexes, [uid] is the same. The length and data of the array is dynamic.
What I need to do is merge the indexes that have the same value for [uid] and sum the values of the non-identifying keys.
Desired result:
[
['id' => 2, 'uid' => 50, 'sum1' => 3, 'sum2' => 6],
['id' => 3, 'uid' => 51, 'sum1' => 3, 'sum2' => 5],
]