note 37043 rejected from function.number-format by pollita
| From: | pollita@php.net | Date: | Fri, 31 Oct 2003 18:41:54 +0000 |
| Subject: | note 37043 rejected from function.number-format by pollita | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59593@lists.php.net to get a copy of this message | ||
Note Submitter: d-php-manual@psuter.ch
----
a little chain of number_format calls helps to round an amout of money to 5 cent accuracy:
it will convert as follows:
8.13 --> 8.15
8.12 --> 8.10
and that's how I did it:
$amount = 8.13;
echo number_format(number_format($amount*2, 1, '.', '')/2, 2, '.',
'');
hope this helps some ohters
cheers
pascal