Lo que puedes hacer es algo asi:
Código PHP:
<?php
$num = 30;
$columnas = 3;
$filas = $num/$columnas;
$html = '<table>';
for($i=0;$i<$filas;$i++){
$html .= '
<tr><!--Fila'.$i.'-->';
for($j=0;$j<$columnas;$j++){
$html .= '
<td>columna '.$j.'</td>';
}
$html .= '
</tr>';
}
$html.= '
</table>';
print $html;
?>
Suerte!