a loop with increasing 3 by 3 :
for ($i=0;$i<$max;$i+=3)
{
print "<TD>".$value[$i]."</TD>";
print "<TD>".$value[$i+1]."</TD>";
print "<TD>".$value[$i+2]."</TD>";
}
I simplify a bit for clarity, but you have to
check that using ($i+1) and ($i+2) you aren't
above $max (you can do that in the loop by
using some if() or before the loop by
adjusting the $max value use in the loop,
and add one or two <TD>...</TD> after the
loop, as you wish.