I want to convert the following 3-level array to a flat, associative array of columnar sums per first level key. Do I need to use a foreach() or can array_sum() do this?
[
'Sum_1' => [
['e' => 1000001, 'u' => 'Test1', 'a' => 775.00],
['e' => 26, 'u' => 'Test2', 'a' => 555.00],
],
'Sum_2' => [
['e' => 1000001, 'u' => 'Test1', 'a' => 110.00],
],
'Sum_3' => [
['e' => 1000001, 'u' => 'Test1', 'a' => 444.00],
],
]
I want to get the sum of element [a] of each section (e.g. Sum_1, Sum_2, Sum_3).
Desired result:
[
'Sum_1' => 1330.00,
'Sum_2' => 110.00,
'Sum_3' => 444.00,
]