use the modulus operator:

($number % 2) returns 0 if the value is even


Larry Jeannette
MIS Director, e.Republic


-----Original Message-----
From: Brandon Orther [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 05, 2001 12:18 PM
To: PHP User Group
Subject: [PHP] Is it odd or even???


Hello,

Is there an easy way to check and see if a number is odd or even?

Thank you,

--------------------------------------------
Brandon Orther
WebIntellects Design/Development Manager
[EMAIL PROTECTED]
800-994-6364
www.webintellects.com
-------------------------------------------- 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to