title: dynamic colspan
body: <p>I have a table will show data from a database. These data count is <code>dynamic</code>. I want to show 4 in each row. However, the problem with the last row. I want if the last row has 1 TD the function will give this td a <code>colspan</code> of 4, so I can show the data in the middle.</p>
  
  <pre><code>NUMBER OF DATA IS 5
  
  ###############################################
  #           TABLE HEADER(colspan=4)           #
  ###############################################
  ||  TD1   ||  TD2  ||   TD3   ||    TD4     ||
  ||  TD5   ||  
  
  I NEED THIS 
  ###############################################
  #           TABLE HEADER(colspan=4)           #
  ###############################################
  ||  TD1   ||  TD2  ||   TD3   ||    TD4     ||
  ||                  TD5                     ||  
  
  and if there are 6 TDS to show it like this.
  
  ###############################################
  #           TABLE HEADER(colspan=4)           #
  ###############################################
  ||  TD1   ||  TD2  ||   TD3   ||    TD4     ||
  ||       TD5       ||          TD6          ||  
  </code></pre>
  
  <p>MY PHP CODE + HTML </p>
  
  <pre><code>&lt;table&gt;
      &lt;tr&gt;
          &lt;th colspan="4"&gt;TABLE HEADER&lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;? $counter = 0;
                  foreach($data as $d)
                  {
                      if($counter % 4 == 0)
                      {
                          echo '&lt;/tr&gt;&lt;tr&gt;';
                      }
                      echo $d['name'];
                      $counter++
                  }
          ?&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Thank's in advance.</p>