function isOdd ($value) {
return (int)$value % 2 ? true : false;
}
Returns true/false if the value is odd. Also rounds down floating point numbers given
as the test value.
-Jeremy
-----Original Message-----
From: Jake McHenry [mailto:[EMAIL PROTECTED]
Sent: Friday, January 16, 2004 2:18 PM
To: [EMAIL PROTECTED]
Subject: [PHP] odd and even numbers
I have a random number being generated from 1 to 501, is there an easy way for me to
tell if the result is an odd or even number?
Thanks,
Jake
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php