I do need to keep track of the results by team number. The final output will be sorted by the team that has the most points. the user would see:
Team #7 | Wins 4 | Ties 2 | Losses 1 | Total Points 14
Team #3 | Wins 3 | Ties 2 | Losses 2 | Total Points 11
So, using your input and experimenting, the way I should go is:
$teamName[$team1]['wins'] += 1;
$teamName[$team1]['ties'] += 1;
$teamName[$team1]['loss'] += 1;
I can see, using print_r that this array has the team number and the number of wins, ties and losses.
But when I use
foreach ($teamName as $key=>$value) {
echo "Team #$key Total wins - $value <br/>";
}
The foreach's output is: Team #1 Total wins - Array
I've read a bunch of websites, but my brain cells can't to put it all together. After the module process all the scores, how do I extract all of the array's contents?
I'll need to sort the arrays, once they are done, in order of highest points. So I plan to add the following code to calculate the points as it gathers the number of wins and ties.
$teamName[$team1]['points'] += 3; // teams earn three points for a win.
Does that seem reasonable?
Thanks for your input. It has been most helpful.