title: creating grid content with repeated array keys
body: <p>I have 15 elements and I want to order them using for() like this;</p>
  
  <blockquote>
    <p>1 2 3
    2 3 1
    3 1 2
    1 2 3
    2 3 1</p>
  </blockquote>
  
  <p>I tried;</p>
  
  <pre><code>for($i=0;$i&lt;=15;$i++){
      $a = 1;
  if($a==1){
      $a=($i%3)+1;
  }elseif($a==2){
      $a=(($i+1)%3);
  }else{
      $a=(($i+2)%3);
  }
      echo $a." ";
  }
  </code></pre>
  
  <p>output is;</p>
  
  <blockquote>
    <p>1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1</p>
  </blockquote>
  
  <p>repeating 1-2-3</p>
  
  <p>rule is simple;
  there should be 3 keys in row and a key can not be used in same row again.</p>