note 39879 deleted from function.floor by danbrown
| From: | danbrown@php.net | Date: | Thu, 10 Mar 2011 15:22:53 +0000 |
| Subject: | note 39879 deleted from function.floor by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177767@lists.php.net to get a copy of this message | ||
Note Submitter: twindagger2k3 at NOSPAMyahoo dot com
----
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.