RE: [PHP] How do I get the result of a Division to 2 decimal places?
| From: | Jay Blanchard | Date: | Tue, 09 Sep 2003 14:59:44 +0000 |
| Subject: | RE: [PHP] How do I get the result of a Division to 2 decimal places? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-162071@lists.php.net to get a copy of this message | ||
[snip]
It is not mentioned in the manual, but it seems dec_point cannot be
empty. If it is empty, default (.) is taken.
....
echo number_format($number, 4, '', ',')."\n";
number_format() does allow an empty set of single quotes in the third
attribute which it will default to a period (.) for the decimal point.
number_format() does require that have all the attributes stated, or it
will throw an error.
So if you do this....
echo number_format($number, 4, ',')."\n";
You should get an error.