title: PHP foreach loop in HTML table 2 per row
body: <p>I have the following PHP loop</p>
  
  <pre><code>foreach ($users as $key =&gt; $name){
      echo $name;
  }
  </code></pre>
  
  <p>It displays quite a few names. I want to display it inside a table column td but after every 2 i want to start a new row. So the table I want to look like this:</p>
  
  <pre><code>&lt;table width="100%" border="0"&gt;
  &lt;tr&gt;
  &lt;td width="50%" align="center"&gt;$name&lt;/td&gt;
  &lt;td width="50%" align="center"&gt;$name&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td width="50%" align="center"&gt;$name&lt;/td&gt;
  &lt;td width="50%" align="center"&gt;$name&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Therefore creating a new table row after every 2 in the loop.</p>
  
  <p>Any ideas how I can achieve this? </p>
  
  <p>Thanks.</p>