I have associative array (dynamic-may have more arrays but same keys):
Array
(
[food] => Array
(
[0] => 3
[1] => 4
[2] => 1
)
[liquor] => Array
(
[0] => 4
[1] => 5
[2] => 0
)
[beer] => Array
(
[0] => 5
[1] => 6
[2] => 0
)
)
I need to us开发者_Python百科e array_sum on each array so result would be:
Array ( [food] => 8, [liquor] => 9, [beer] => 11 )
Thanks!
$result = array_map('array_sum', $your_array);
Example: http://ideone.com/LqTAV
精彩评论