How to make new row every 4 column in phpword and Codeigniter?
<p>This is my code, it give result if columns are 3 it will make new row but not for multiple 3.</p>

<pre><code>    foreach ($tampil_data as $key=&gt;$tampildata) {
        $table-&gt;addCell(2000)-&gt;addText(htmlspecialchars($tampil_data[$key]-&gt;elektronik_nama));   //load data
        if($key==3){
            $table-&gt;addRow(); //make new row
        }
    }
</code></pre>

<p>i want to make table every have 3 column or multiple of 3, it makes new row. How can i resolve it?</p>