note 36931 deleted from function.floor by nlopess
| From: | nlopess@php.net | Date: | Thu, 10 Nov 2005 18:30:38 +0000 |
| Subject: | note 36931 deleted from function.floor by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-98402@lists.php.net to get a copy of this message | ||
Note Submitter: rob at thijssen dot co dot uk
----
A slightly cleaner way to check for odd or even values is to use a bitwise AND (since it requires
less processing than divison).
<?php
function oddeven($x){
if($x & 1) return "odd";
else return "even";
}
?>