note 115008 added to function.ceil
| From: | josoort at home dot nl | Date: | Mon, 12 May 2014 07:14:57 +0000 |
| Subject: | note 115008 added to function.ceil | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199517@lists.php.net to get a copy of this message | ||
You can simply make a ceil with decimals function by using the round() function and add 0.05 to the
value if the value must have 1 decimal accuracy, or 0.005 for 2 decimals accuracy, or 0.0005 for 3
decimals etc.
Example :
function ceilDec($input, $decimals)
{
$subtract = 5 / pow(10, $decimals + 1);
$output = round($input + $subtract, $decimals);
return $output;
}
----
Server IP: 83.137.20.135
Probable Submitter: 84.27.186.179
----
Manual Page -- http://php.net/manual/en/function.ceil.php
Edit -- https://master.php.net/note/edit/115008
Del: integrated -- https://master.php.net/note/delete/115008/integrated
Del: useless -- https://master.php.net/note/delete/115008/useless
Del: bad code -- https://master.php.net/note/delete/115008/bad+code
Del: spam -- https://master.php.net/note/delete/115008/spam
Del: non-english -- https://master.php.net/note/delete/115008/non-english
Del: in docs -- https://master.php.net/note/delete/115008/in+docs
Del: other reasons-- https://master.php.net/note/delete/115008
Reject -- https://master.php.net/note/reject/115008
Search -- https://master.php.net/manage/user-notes.php