I have data below :
Array(
[A] => Array
(
[AA] => 10
)
[B] => Array
(
[BA] => 5
[BB] => 1
[BC] => -2
)
[C] => Array
(
[CA] => 3
[CB] => 0
)
)
I want to sum the value of second element my array (BA,BB,BC, etc) like this :
Array(
[A] => 10
[B] => 4
[C] => 3
)
I've tried to do with foreach (I'm using php as my platform) but the result is wrong, can someone give me explanation and the logic to solve this? thanks