At 00:42 6-4-2003, you wrote:
Wow you guys are going about that way more complicated than it needs to be:
$i = 0; echo "<TR BGCOLOR='#". (($i++ % 2 == 0) ? "'E3E3E3" : "FFFFFF") ."'>";
Then it just alternates and takes care of itself (plus you get a nice little index counter as well as a bonus if you want to use $i
DÆVID.
Or in my belief even faster, (without the bonus):
$i = TRUE; {$i=!$i; echo "<TR BGCOLOR='#". (($i) ? "'E3E3E3" : "FFFFFF") ."'>"; }
Since your code has these steps: 1. increment $i 2. divide $i by 2 and keep the remains 3. compare remains with 0 4. make the true/false decision
And the TRUE type: 1. toggle boolean 4. make the true/false decision
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php