$vis and $home are shortened team name variables like "ACE, HIT, COU..." and vis1 and home1 are the game one scores like" 05, 10..."
$vis and $home are the associative array keys for the $standings array. Originally I made a copy of my main schedule and converted all team names to numbers so that I could use them as numeral indexing for the arrays. Just want to eliminate that step and use the original schedule.
I want to use functions alot more, just need to understand a couple issues I have with them. Like I had said, the "includes" worked perfectly....I want to use functions instead ( I believe it is faster and more of the proper way...correct??)
Code: Select all
function game1($vis, $home, vis1, home1)
{
global $outcome, $overall, $standings;
$standings=array();
$outcome=array();
$overall=array();
$v=sizeof($outcome['$vis']); //used for the visitor team streak
$h=sizeof($outcome['$home']); //used for the home team streak
$standings['$vis'][1]+=1; //game_vis games played+1 (game1)
$standings['$home'][1]+=1; //game_home games played+1 (game 1)
$standings['$vis'][6]+=vis1; //game_vis games runs for (game1)
$standings['$home'][6]+=home1; //game_home games runs for (game1)
$standings['$vis'][7]+=home1; //game_vis games runs against (game1)
$standings['$home'][7]+=vis1; //game_home games runs against (game1)
if (vis1>home1){ //game1 loop (vis1>home1)
$standings['$vis'][2]+=1; //game_vis wins+1 (game1)
$standings['$home'][3]+=1; //game_home losses+1 (game1)
$overall['$vis']['$home']+=1; //head to head (game_vis win+1 against game_home)
$outcome['$vis'][$v]="W"; //game_vis "win" outcome for game1
$outcome['$home'][$h]="L"; //game_home "Loss" outcome for loser
}elseif (vis1<home1){ //game1 vis1<home1
$standings['$vis'][3]+=1; //vis loses+1
$standings['$home'][2]+=1; //home wins+1
$overall['$home']['$vis']+=1; //head to head (home win-vis lose)+1
$outcome['$vis'][$v]="L"; //game_vis1 loser
$outcome['$home'][$h]="W"; //game_home1 winner
}else{ //game1 vis1=home1
$standings['$vis'][4]+=1; //vis team ties+1
$standings['$home'][4]+=1; //home team ties+1
$outcome['$vis'][$v]="T"; //game_vis tie
$outcome['$home'][$h]="T"; //game_home tie
} //end game1 loop
}