Q:

php a for loop machine

I have a array which stored few integers
I expect to use table and the for loop loop through the array
therefore, the details of the code probably like as below:
for($i=0;$i<sizeof($array);$i++){
<table>
<tr><td>$array[$i]</td></tr>
</table>

However, I would like to add a function:
each of the table row is specified to 2 columns,
finally the result should like as following.
34 23
11 10
29 10
......and so on.
plz help me ,thanks a lot :)

A:

<table>
<?php
$size = sizeof($array);              // Store the size to reduce computations
for($i=0;$i<$size;$i+=2)              // Loop through the array
{
    echo("<tr>");                    // Print row begin tag
    echo("<td>".$array[$i]."</td>"); // Print out first column value
    if ($i + 1 < $size)              // If we can, print out the second column value
        echo("<td>".$array[$i+1]."</td>");
    echo("</tr>");                   // Print row end tag
}
?>
</table>

