note 53434 added to function.round
| From: | sales at ghostscripter dot com | Date: | Wed, 01 Jun 2005 13:23:42 +0000 |
| Subject: | note 53434 added to function.round | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-89739@lists.php.net to get a copy of this message | ||
If you want to round to the nearest increment, say to the nearest 50 you can do it like this:
echo nearestto(50,236);
function nearestto($amount,$number)
{
$counted = round($number/$amount);
return ($counted*$amount);
}
----
Manual Page -- http://www.php.net/manual/en/function.round.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53434
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53434&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53434&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53434&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53434&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53434&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53434&report=yes
Search -- http://master.php.net/manage/user-notes.php