At 9:32 AM + 10/30/07, Hulf wrote:
Hi,
Is there a built in function in PHP5 to determine if an integer is even or
odd?
Ross
Try:
echo($integer & 1);
1 = odd, 0 = even.
Cheers,
tedd
--
---
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mail
At 09:32 30/10/2007, Hulf wrote:
Hi,
Is there a built in function in PHP5 to determine if an integer is even or
odd?
How about :
if ($IntegerValue % 2) {
// odd
} else {
// even
}
HTH
J
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php
Hi,
Is there a built in function in PHP5 to determine if an integer is even or
odd?
Ross
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
3 matches
Mail list logo