title: a while loop inside a for loop not working in codeigniter view file
body: <p>so I have a codeigniter view file that has a code inside like this:</p>
  
  <pre><code>  &lt;?php for($i=1; $i &lt;= count($headings); ): ?&gt;
        &lt;div class="row"&gt;
        &lt;?php while(($i%3) != 0 ): ?&gt;
            &lt;div class="span4"&gt;
            &lt;?php $heading = current($headings); ?&gt;       
                &lt;h2&gt;&lt;?= key($headings); ?&gt;&lt;/h2&gt;
                &lt;p&gt;&lt;?= $heading['description']; ?&gt;&lt;/p&gt;
                &lt;p&gt;&lt;a class="btn" href="&lt;?= $heading['link']; ?&gt;"&gt;View details &amp;raquo;&lt;/a&gt;&lt;/p&gt;  
                &lt;?php next($headings); ?&gt;
                &lt;?php $i++; ?&gt;
             &lt;/div&gt; &lt;!-- end of div.span4 --&gt;
             &lt;?php endwhile; ?&gt;
         &lt;/div&gt; &lt;!-- end of div.row --&gt;
     &lt;?php endfor; ?&gt;
  </code></pre>
  
  <p>What I want to achieve here is to loop through the array <code>($headings)</code> by three's. I want to produce something like this:</p>
  
  <pre><code>&lt;div class="row"&gt;
      &lt;div class="span4"&gt;&lt;!-- $heading element --&gt;&lt;/div&gt;
      &lt;div class="span4"&gt;&lt;!-- $heading element --&gt;&lt;/div&gt;
      &lt;div class="span4"&gt;&lt;!-- $heading element --&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="row"&gt;
      &lt;div class="span4"&gt;&lt;!-- $heading element --&gt;&lt;/div&gt;
      &lt;div class="span4"&gt;&lt;!-- $heading element --&gt;&lt;/div&gt;
      &lt;div class="span4"&gt;&lt;!-- $heading element --&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="row"&gt;
      &lt;div class="span4"&gt;&lt;!-- $heading element --&gt;&lt;/div&gt;
      &lt;div class="span4"&gt;&lt;!-- $heading element --&gt;&lt;/div&gt;
  &lt;/div&gt;\
  </code></pre>
  
  <p>at the above example the <code>$heading</code> array contains 8 elements, so it produce 2 <code>div</code>'s with a class of row, inside is 3 <code>div</code>'s with a class of <code>span4</code>. With the third div of class row only containing 2 <code>div</code>'s of class <code>span4</code>.</p>
  
  <p>Now, when I try to run this on the web server, it returns an empty page, no HTML tags whatsoever or PHP error. And i'm pretty sure that my php <code>error_reporting</code> is set to <code>E_ALL</code>. Tried to remove it and the page loads fine (of course without div's that the code in question should create).</p>
  
  <p>i resolve this problem by using a different logic. see below</p>
  
  <pre><code>&lt;?php for($i=1; $i &lt;= count($headings); ): ?&gt;
  &lt;div class="row"&gt;
      &lt;?php for($k=1; $k &lt;= 3; $k++): ?&gt;
      &lt;div class="span4"&gt;
          &lt;?php $heading = current($headings); ?&gt;
          &lt;?php if ($heading !== false): ?&gt;
              &lt;h2&gt;&lt;?= key($headings); ?&gt;&lt;/h2&gt;
              &lt;p&gt;&lt;?= $heading['description']; ?&gt;&lt;/p&gt;
              &lt;p&gt;&lt;a class="btn" href="&lt;?= $heading['link']; ?&gt;"&gt;View details &amp;raquo;&lt;/a&gt;&lt;/p&gt;
          &lt;?php endif ?&gt;
          &lt;?php next($headings); ?&gt;
          &lt;?php $i++; ?&gt;
      &lt;/div&gt; &lt;!-- end of div.span4 --&gt;
      &lt;?php endfor; ?&gt;
  &lt;/div&gt; &lt;!-- end of div.row --&gt;
  &lt;?php endfor; ?&gt;
  </code></pre>
  
  <p>but still i'm wondering as to why the code in question doesn't work when logically it should be fine.</p>
  
  <p>Am I missing something or does codeIgniter prevents nested loop of such way. Is it a bug?</p>
  
  <p>Thanks in advance for the answers!.</p>