codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php $months = Array ( "may" => Array ( "A" => 101, "B" => 33, "C" => 25 ), "june" => Array ( "A" => 73, "B" => 11, "D" => 32 ), "july" => Array ( "A" => 45, "C" => 12 ) ); foreach ($months as $month) { foreach ($month as $letter => $value) { if (isset($months['all'][$letter])) { $months['all'][$letter] += $value; } else { $months['all'][$letter] = $value; } } } print_r($months['all']);
Private
[
?
]
Run code
Submit