|
PHP. FOR, WHILE, FOREACH Loops and inside operations, PART 3 |
Generate table- different colors: <table width="100%"> <?
$a = array("01", "11", "21", "31", "38", "41", "48", "51", "58", "61", "68", "71", "78", "81", "88", "91", "98", "A1", "A8", "B1", "B8", "C1", "C8", "D1", "D8");
// hmm... let's say the array exists. as i said, it has 26 elements.
$count = count($a); for($x=0;$x<=$count;$x++) { $c = "#{$a[$x]}{$a[$x]}{$a[$x]}"; ?>
<tr><td bgcolor="<?= $c ?>" align="center"> <?= $a[$x]; ?> </td></tr> <?
}
?>
</table>
|