Codice PHP:
<?php
$array 
range(1,16);
echo 
"<table>";
echo 
"<tr>";
$i 1
foreach (
$array as $numero)
{
       echo 
"<td>";
       echo 
$numero
       echo 
"</td>";
    
    if (
$i == 0
    { 
      echo 
"</tr>"
      echo (
$i count($array)) ? "<tr>" ""
    } 

$i++; 
}   
echo 
"</table>";
?>
La devi solo adattare alle tue esigenze.