Formatting Decimals
| From: | Rick Dwyer | Date: | Mon, 11 Jan 2010 01:36:34 +0000 |
| Subject: | Formatting Decimals | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-300958@lists.php.net to get a copy of this message | ||
Hello List.
Probably an easy question, but I am not able to format a number to round up from 3 numbers after the decimal to just 2.
My code looks like this:
$newprice = "$".number_format($old_price, 2, ".", ",");
and this returns "$0.109" when I am looking for "$0.11".
I tried:
$newprice = "$".round(number_format($old_price, 2, ".", ","),2);
But no luck.
Any help is appreciated.
Thanks,
--Rick