note 23182 deleted from function.floor by dams
| From: | dams@php.net | Date: | Sun, 28 Jul 2002 14:49:03 +0000 |
| Subject: | note 23182 deleted from function.floor by dams | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-33820@lists.php.net to get a copy of this message | ||
> The sample to show "odd" or "even" doesn't work
> like that. Use this:
Actually, the best (and most elegant) way to check if a number is odd or even is to use the modulus
operator:
if ($number%2 == 0) {
// Even
} else {
// Odd
}