<?php
$t1 = array (
"basicInfo" => array (
"The Sineps",
"December 25, 2010",
"lemonpole"
),
"overallRecord" => array (
0,
0,
0,
0
),
"overallSeasons" => array (
"season1.cs" => array (0, 0, 0),
"season2.cs" => array (0, 0, 0)
),
"matches" => array (
"season1.cs" => array (
"week1" => array ("12", "3", "1"),
"week2" => array ("8", "8" ,"0"),
"week3" => array ("8", "8" ,"0")
),
"season2.cs" => array (
"week1" => array ("9", "2", "5"),
"week2" => array ("12", "2" ,"2")
)
)
);
foreach ($t1['matches'] as $season => $weeks) {
foreach ($weeks as [$w, $l, $d]) {
$t1['overallSeasons'][$season][0] += $w;
$t1['overallSeasons'][$season][1] += $l;
$t1['overallSeasons'][$season][2] += $d;
}
}
var_export($t1);
preferences:
24.35 ms | 404 KiB | 5 Q