title: Simple and idiot loop that I can't figure how to do it
body: <p>I have to iterate over an array and display its items. I have to paginate it so I can render a paginator. The paginator structure is something like:</p>
  
  <pre><code>&lt;div class='paginator'&gt;
      &lt;div class="page"&gt;
          &lt;img src="path/to/picture"/&gt;
          &lt;img src="path/to/picture"/&gt;
          &lt;img src="path/to/picture"/&gt;
          &lt;img src="path/to/picture"/&gt;
      &lt;/div&gt;
      &lt;div class="page"&gt;
          &lt;img src="path/to/picture"/&gt;
          &lt;img src="path/to/picture"/&gt;
          &lt;img src="path/to/picture"/&gt;
          &lt;img src="path/to/picture"/&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Finally, I have a PHP array with the paths. I want something like this:</p>
  
  <pre><code>echo "&lt;div class='paginator'&gt;";
  for ($i = 0; $i &lt; 3; $i++) {
     echo "&lt;div class='page'&gt;";
     for($j = 0; $j &lt; 4; $j++) {
        echo "&lt;img src='" . $arr[$i * $j] . "'/&gt;"     
     }
     echo "&lt;/div&gt;
  }
  echo "&lt;/div&gt;";
  </code></pre>
  
  <p>But, it doesn't work. I'm doing the loops incorrectly and I can't figure out how they should be.</p>