note 37384 deleted from language.operators.comparison by danbrown
| From: | danbrown@php.net | Date: | Thu, 18 Jun 2009 14:17:08 +0000 |
| Subject: | note 37384 deleted from language.operators.comparison by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-157092@lists.php.net to get a copy of this message | ||
Note Submitter: xhenxhe
----
This operator is very is usefull and will save you time and lines once you get the hang of it. Try
this next time you are looping through rows in a table and want to change the bgColor:
<table border=1 width=100% align=center style="border-collapse: collapse"
bgColor="lightblue">
<tr>
<td>Column 1</td>
<td>Column 2</td>
<td>Column 3</td>
<td>Column 4</td>
</tr>
<?
while ($i++ < 10)
{
$rbg = $rbg=="#EEEEEE" ? "#FFFFFF" : "#EEEEEE";
?>
<tr bgColor="<?=$rbg?>">
<td>Cell 1-<?=$i?></td>
<td>Cell 2-<?=$i?></td>
<td>Cell 3-<?=$i?></td>
<td>Cell 4-<?=$i?></td>
</tr>
<? } ?>
</table>