Re: decimal places
| From: | Kevin Stone | Date: | Tue, 26 Nov 2002 19:35:54 +0000 |
| Subject: | Re: decimal places | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-126161@lists.php.net to get a copy of this message | ||
Try.. printf("%.2f", $amount);
-Kevin
----- Original Message -----
From: "Bryan Koschmann - GKT" <gktnews@gktech.net>
To: "PHP General" <php-general@lists.php.net>
Sent: Tuesday, November 26, 2002 12:29 PM
Subject: [PHP] decimal places
> Hello,
>
> Does anyone here have a good way to make sure dollar amounts are formatted
> properly? I have something that returns data, but the problem is it's
> stored where any trailing zero isn't kept, like this:
>
> $16.95 or $172.82 are fine
>
> $17.90 or $190.20 come back as $17.9 and $190.2
>
> I would like to make sure they are all properly formatted. Any ideas?
>
> Thanks in advance,
>
> Bryan
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>