Let me get this straight you have 1 to x teams, each team must play each other team 1, each team can only play once per week with no bis.
First let's talk size:
Each team will have x entries in the system, however this is unordered so if team one plays team two then team two played team one.
Okay now this means the following is true:
t1 = x entries
t2 = x-1 entries
.
.
.
tn = x - (n-1) entries
.
.
.
tx = 0 entries
So you're total entries in terms of x is
ary_length = 0;
for(i=1;i<x;i++)
ary_length = ary_length + x - (i-1);
this reduces to about x2 entries in the array.
I seriously hope that x is staying small.
okay now let's talk algorithm:
1) create an array that lists all the teams
<?php
$teams_ary = array();
for($i=0;$i<$x;$i++) {
$teams_ary[$i] = 'Team ' . $i+1;
}
?>
2) make each team play each other team. Each team can only play once per week.
<?php
$schedule_ary = array()
for($i=0;$i<$x;$i++) {
$t_one = $teams_ary[$i];
for($j = $i+1;$j<=$x;$j++) {
$Week = $i + $j;
$t_two = $teams_ary[($i+$j)];
$schedule_ary[(pow(2,$i)+$j] = array(
'Week' => $Week,
'Team 1' => $t_one,
'Teams 2' => $t_two);
} //end for j
} //end for i
?>
3) figure out how to fix the problem this algorithm has where one game is played in the first week and one game is played in the last week with the graph of the games played per week looking like a cone.
4) figure out how to make this algorithm work of odd numbers of x.