note 37979 deleted from language.operators.comparison by danbrown
| From: | danbrown@php.net | Date: | Thu, 18 Jun 2009 14:16:45 +0000 |
| Subject: | note 37979 deleted from language.operators.comparison by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-157091@lists.php.net to get a copy of this message | ||
Note Submitter: mina86 at tlen dot pl
----
I guess quicker method would be:
<?php
$colors = array('#EEEEEE', '#FFFFFF');
while ($i++ < 10) {
?>
<tr bgColor="<?=$colors[$i%2]?>">
<td>Cell 1-<?=$i?></td>
<td>Cell 2-<?=$i?></td>
<td>Cell 3-<?=$i?></td>
<td>Cell 4-<?=$i?></td>
</tr>
<?php } ?>
And you can easily add more colors:
<?php
$colors = array('#EEEEEE', '#FFFFFF', '#DDDDDD', '#CCCCCC');
while ($i++ < 10) {
?>
<tr bgColor="<?=$colors[$i%4]?>">
<td>Cell 1-<?=$i?></td>
<td>Cell 2-<?=$i?></td>
<td>Cell 3-<?=$i?></td>
<td>Cell 4-<?=$i?></td>
</tr>
<?php } ?>