I have the following associative array:
Current Array:
Array
(
[0] => Array
(
[num] => 51
[totalparcial] => 2.50
)
[1] => Array
(
[num] => 51
[totalparcial] => 3.70
)
[2] => Array
(
[num] => 52
[totalparcial] => 5.00
)
[3] => Array
(
[num] => 52
[totalparcial] => 22.00
)
[4] => Array
(
[num] => 52
[totalparcial] => 14.00
)
)
How can I get index information that has the same value in [num]
, add [totalparcial]
, and create a new array with these new values?
In this example I would like the final result to be an array like this:
Array Desired:
Array
(
[0] => Array
(
[num] => 51
[totalparcial] => 6.20
)
[1] => Array
(
[num] => 52
[totalparcial] => 41.00
)
)
Thanks!