Re: Odds and Evens!
| From: | Andreas Pour | Date: | Tue, 22 Aug 2000 14:27:53 +0000 |
| Subject: | Re: Odds and Evens! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-12949@lists.php.net to get a copy of this message | ||
Chris Murley wrote:
>
> Does anyone have a function that you pass a number to, and that would
> return odd or even depeneding on what the number is?
Off the top of my head:
function odd($val)
{ return ($val & 1 == 1); }
function even($val)
{ return ($val & 1 == 0); }
Ciao,
Andreas