note 60353 deleted from function.fmod by tularis
| From: | tularis@php.net | Date: | Wed, 04 Jan 2006 18:04:31 +0000 |
| Subject: | note 60353 deleted from function.fmod by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-101209@lists.php.net to get a copy of this message | ||
Note Submitter: John Craig
Reason: useless
----
I have been using fmod() to determine whether a number is odd or even. For example;
When printing HTML table rows, I would like every-other row to have a colored background for easy
reading. Here's the code:
<? if (fmod($x, 2) == "") { echo 'bgcolor="#F6F6F6"'; } ?>
Just stick that line inside the <tr> tag and you're all set!
Also, if you would like the even rows to be another color, add the else statement as such;
<? if (fmod($x, 2) == "") { echo 'bgcolor="#F6F6F6"'; } else { echo
'bgcolor="#CCCCCC"'; } ?>
Feel free to comment - Happy Coding!