note 91037 deleted from function.ceil by danbrown
| From: | danbrown@php.net | Date: | Fri, 22 May 2009 14:47:46 +0000 |
| Subject: | note 91037 deleted from function.ceil by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155890@lists.php.net to get a copy of this message | ||
Note Submitter: stevekirkby at gmail dot com
----
Hi
I've always used coxswain's solution if it's a one off calculation. e.g.
To CEIL/FLOOR to 3 decimal places, multiply the value by 1000, apply the CEIL/FLOOR function and
then divide by 1000. 2dp would be 100, 5 dp would be 100000
eg a value of 4.827364237 multiplied by 1000 becomes 4827.364237 which when 'FLOOR'ed
equals 4827, and divided by 1000 equals 4.827
$value = CEIL($value*1000)/1000;
$value = FLOOR($value*1000)/1000;
Steve