$mng = ceil(count($genarr) / 6);
$gr_arr = array_chunk($genarr, $mng);
echo "<table width='100%'><tr>";
for ($i=0; $i<count($gr_arr); $i++) {
echo "<td valign='top'>";
echo "<table>";
for ($j=0; $j<count($gr_arr[$i]); $j++) {
echo "<tr><td>".$gr_arr[$i][$j]."</td></tr>";
}
echo "</table>";
echo "</td>";
}
echo "</tr></table>";