define("NUMCOLS",5); // 列の数
reset($hoge);
echo "<table>\n";
foreach ($hoge as $key->$val) {
 if ($key % (NUMCOLS - 1) == 0) {
  echo "<tr>\n";
 }
 echo "<td>".$val."</td>\n";
 if ($key % NUMCOLS == 0) {
  echo "</tr>\n";
 }
}
echo "</table>\n";