note 29487 added to function.floor

From: Date: Fri, 14 Feb 2003 20:52:30 +0000
Subject: note 29487 added to function.floor
Groups: php.notes 
Request: Send a blank email to php-notes+get-43956@lists.php.net to get a copy of this message
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 person’s age by comparing their birthday with the current date and rounding down: <? $age = floor((date(Ymd) - $bday)/10000); ?> -- http://www.php.net/manual/en/function.floor.php http://master.php.net/manage/user-notes.php?action=edit+29487 http://master.php.net/manage/user-notes.php?action=delete+29487 http://master.php.net/manage/user-notes.php?action=reject+29487

« previous php.notes (#43956) next »