 <p>I think this could help you. Defining your values directly as arrays, and representing them with a foreach loop. It's more like the way mysql_fetch_array represents the records obtained from the database.</p> <pre><code>$values = []; $values[] = [1, "A", "red"]; $values[] = [2, "B", "blue"]; $values[] = [3, "C", "yellow"]; $values[] = [4, "D", "orange"]; echo '&lt;table&gt;'; foreach ($values as $value) { echo '&lt;tr&gt;'; echo '&lt;td&gt;'.$value[0].'&lt;/td&gt;'; echo '&lt;td&gt;'.$value[1].'&lt;/td&gt;'; echo '&lt;td&gt;'.$value[2].'&lt;/td&gt;'; echo '&lt;/tr&gt;'; } echo '&lt;/table&gt;'; </code></pre>