RE: [PHP] Variable Precision
| From: | Boget, Chris | Date: | Fri, 21 Jul 2000 15:28:10 +0000 |
| Subject: | RE: [PHP] Variable Precision | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-7578@lists.php.net to get a copy of this message | ||
> How can you set the precision for float-type variables like
> with C/C++? I'm trying to output a monetary amount
> but can't seem to figure out how to keep trailing zeros. I
> know it's probably very easy. Could someone please enlighten
> me?
2 functions can help you here:
number_format()
printf()
If you are familiar with C/C++, you know how to use printf().
However, I generally use number_format() as it is much simpler.
Chris