$values = array('00','33','66','99','cc','ff');
$endval = "6";
$endval2 = $endval - 1;
for($a=0;$a<$endval;$a++){
echo "<table width=\"900\"><tr>";
for($b=0;$b<$endval;$b++){
for($c=0;$c<$endval;$c++){
$bgcolor = $values[$a].$values[$b].$values[$c];
echo "<td bgcolor=\"". $bgcolor ."\">".$values[$a].$values[$b].$values[$c]."</td>";
if($c == "$endval2"){
echo "</tr>\n<tr>";
}
}
}
echo "</tr></table>\n";
}