RE: [PHP] Precision value in PHP??
| From: | Chris W. Parker | Date: | Wed, 13 Aug 2003 17:24:37 +0000 |
| Subject: | RE: [PHP] Precision value in PHP?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-159457@lists.php.net to get a copy of this message | ||
Scott Fletcher <mailto:scott@abcoa.com>
on Wednesday, August 13, 2003 10:27 AM said:
> When I do this calculation, 77 * 2.00 = 154.00 but with PHP, it
> return only "154". So, how do I set the precision value.
Use the number_format() function. Works just like you want.
echo number_format($myNum,2);
You can read more about it here: http://php.net/number_format.
HTH!
Chris.