RE: [PHP] Odds and Evens!
| From: | Boget, Chris | Date: | Tue, 22 Aug 2000 14:34:50 +0000 |
| Subject: | RE: [PHP] Odds and Evens! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-12951@lists.php.net to get a copy of this message | ||
> Does anyone have a function that you pass a number to, and that would
> return odd or even depeneding on what the number is?
function oddOrEven( $num ) {
return ( $num % 2 );
}
The above will return:
1 if odd
0 if even
Chris