title: Run script every 1st and 4th time inside a PHP while loop based on MySQL result
body: <p>I have a <code>while</code> <code>loop</code> fetching data from a <code>MySQL</code> table. The number of returned rows is unknown. I want to run parts of code inside the <code>loop</code> on every 1st and 4th item, like:</p>
  
  <pre><code>while ($result = $stmt-&gt;fetch()) {
  
     //Run on first row always, then repeat on the 4th item and so on.
     echo '&lt;div class="row"&gt;';
  
  }
  </code></pre>
  
  <p>How can I do this?</p>