I have a total black out. I have one array with n elements which has the results of a team, such as:
array(teamid, wins, losses, draws, goals);
array(1, 2, 3, 4, 5);
array(2, 2, 3, 4, 5);
array(1, 1, 2, 2, 6);
array(2, 2, 3, 4, 5);
I want to iterate through this array and sum up the values for each team-id in a second array. Such as:
$results = getResults();
$final = array();
foreach ($results as $result) {
foreach ($results as $res) {
if ($res['team_id'] == $result['team_id']) {
...
}
}
}
foreach ($final as $finalresult) {
...print result
}
In the end I want an array with e.g. in this example 2 values with 2 different team ids, each values summed up, but I have a blackout at the moment.
Does anybody have a solution?
Thanks.