title: Tournament algorithm in php
body: <p>I need some help. I want to create one tournament. Let's say I have 6 players. 1 2 3 4 5 6</p>
  
  <p>I want to create some.. lets' say stages... Every player will play 5 matches(number of players - 1), in 5 different stages. In one stage, all the players must appear only once.</p>
  
  <p>For example, with 6 players I want to generate these results:</p>
  
  <pre><code>Squad 1:
  
  1-2
  3-4
  5-6
  
  Squad 2:
  
  1-3
  2-5
  4-6
  
  Squad 3:
  
  1-4
  2-6
  3-5
  
  Squad 4:
  
  1-5
  2-4
  3-6
  
  Squad 5:
  
  1-6
  2-3
  4-5
  </code></pre>
  
  <p>So, in every stage, the matches must be unique, and every player must play with every player.</p>
  
  <p>I want one algorithm that will work even if I want 8 players, or 12, or 16, or 28.</p>
  
  <p>Thanks</p>