note 39879 added to function.floor
| From: | twindagger2k3 at NOSPAMyahoo dot com | Date: | Fri, 13 Feb 2004 20:58:08 +0000 |
| Subject: | note 39879 added to function.floor | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-65117@lists.php.net to get a copy of this message | ||
In response to PHP Helper, the floor function does strip the decimal part if the number is positive.
However, if the number is negative, it will not. for example:
<?php
$test = 5.6;
echo floor($test); //5
$test = -5.6;
echo floor($test); //-6
?>
The rounding mentioned in PHP Helper's post will work for both positive and negative numbers.
----
Manual Page -- http://www.php.net/manual/en/function.floor.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39879
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39879&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39879&report=yes
Search -- http://master.php.net/manage/user-notes.php