note 49351 added to function.floor
| From: | peter at harbour-design dot co dot uk | Date: | Tue, 25 Jan 2005 09:52:50 +0000 |
| Subject: | note 49351 added to function.floor | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-83915@lists.php.net to get a copy of this message | ||
If you are after just removing the decimal places and returning an integer, try:
<?
$iPosDecimalNo = 5.67;
$iNegDecimalNo = -5.67;
print (int)$iPosDecimalNo;
print (int)$iNegDecimalNo;
?>
result will:
5
-5
No rounding up or down, just truncation and works for 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+49351
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49351&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49351&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49351&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49351&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49351&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49351&report=yes
Search -- http://master.php.net/manage/user-notes.php