note 29487 deleted from function.floor by danbrown
| From: | danbrown@php.net | Date: | Thu, 10 Mar 2011 15:23:31 +0000 |
| Subject: | note 29487 deleted from function.floor by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177768@lists.php.net to get a copy of this message | ||
Note Submitter: asp55 at digiclub dot org
----
Just a quick example of how to use this method
The first is just used to determine whether a number is even or odd:
<?
if(($x - (2 * floor($x/2))) == 0) echo "even";
else echo "odd";
?>
The second is just to determine a persons age by comparing their birthday with the current date
and rounding down:
<? $age = floor((date(Ymd) - $bday)/10000); ?>