note 49854 added to function.round
| From: | php-general at lists dot php dot net | Date: | Thu, 10 Feb 2005 14:23:39 +0000 |
| Subject: | note 49854 added to function.round | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84793@lists.php.net to get a copy of this message | ||
If you want more speed, and you dont need any decimals returned, use this:
<?php
$number = 254.51263;
$round = (int)($number+0.5); // 255
?>
This way is 32% faster than calling the round() function in this situation (tested!).
----
Manual Page -- http://www.php.net/manual/en/function.round.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49854
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49854&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49854&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49854&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49854&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49854&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49854&report=yes
Search -- http://master.php.net/manage/user-notes.php