title: how to make an infinite loop on array
body: <p>i need to get an item out of an array every 5 time i loop on a for clause</p>
  
  <p>my array</p>
  
  <pre><code>$myArray = array( 1 =&gt; 'element 1',  2 =&gt; 'element 2',  3 =&gt; 'element 3' );
  </code></pre>
  
  <p>my for loop</p>
  
  <pre><code>for ($i=1; $i&lt;=50; $i++) {
  
    echo "echo this each time ";
  
    if ($i%5 === 0) $myitem = next($myArray);
    echo "echo my array item every 5 times " .$myitem; 
    // but starting again from first if i reach the end of array
  
  }
  </code></pre>
  
  <p>i need to get first item in array if i reach the end</p>