Re: decimal places
| From: | Bryan Koschmann - GKT | Date: | Tue, 26 Nov 2002 19:52:32 +0000 |
| Subject: | Re: decimal places | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-126166@lists.php.net to get a copy of this message | ||
Perfect!
Thanks for the quick responses everyone! I really appreciate the help.
Have a good day!
Bryan
On Tue, 26 Nov 2002, Matt Vos wrote:
|As an addition to that, if you don't want the thousands separator to be ',';
|do the following:
|
|$amount = 1234.567
|$fmt1 = number_format($amount,2);
|$fmt2 = number_format($amount,2,'.','');
|echo("$fmt1\n$fmt2");
|
|This will output:
|1,234.56
|1234.56
|
|Matt
|----- Original Message -----
|From: Van Andel, Robert <RVanAndel@chartercom.com>
|To: Bryan Koschmann - GKT <gktnews@gktech.net>; PHP General
|<php-general@lists.php.net>
|Sent: Tuesday, November 26, 2002 2:36 PM
|Subject: RE: [PHP] decimal places
|
|
|
|$amount = 17.9;
|$dollars = "$" . number_format($amount, 2);
|echo "$dollars";
|
|you should see $17.90.
|Robbert van Andel
|
|
|-----Original Message-----
|From: Bryan Koschmann - GKT [mailto:gktnews@gktech.net]
|Sent: Tuesday, November 26, 2002 11:29 AM
|To: PHP General
|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
|
|
|
|
|
|This email and any files transmitted with it are confidential and intended
|solely for the use of the individual or entity to whom they are addressed.
|If you have received this email in error please notify the system manager.
|This message contains confidential information and is intended only for the
|individual named. If you are not the named addressee you should not
|disseminate, distribute or copy this e-mail.
|
|--
|PHP General Mailing List (http://www.php.net/)
|To unsubscribe, visit: http://www.php.net/unsub.php
|
|
|
|