RE: [PHP] number_format question
| From: | Martin Towell | Date: | Fri, 01 Nov 2002 02:42:22 +0000 |
| Subject: | RE: [PHP] number_format question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-122374@lists.php.net to get a copy of this message | ||
what about str_replace(",", "", $str) before you pass the value to
number_format()?
-----Original Message-----
From: ed@home.homes2see.com [mailto:ed@home.homes2see.com]
Sent: Friday, November 01, 2002 9:37 AM
To: Jay Blanchard
Cc: php-general@lists.php.net
Subject: RE: [PHP] number_format question
Tried it. It works but crops everything after the first "," in the number
if you enter a number with commas. Works great if you don't enter any
commas.
What I need to be able to do:
IN OUT
123456789 > 123,456,789
123456789.00 > 123,456,789
123,456,789.00 > 123,456,789
Ed
On Thu, 31 Oct 2002, Jay Blanchard wrote:
> [snip]
> If I try that I get a wrong parameter count error.
>
> [/snip]
>
> number_format ( float number [, int decimals [, string dec_point [, string
> thousands_sep]]])
>
> number_format($number, 0, '', ',');
>
> Try that ...
>
> Jay
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php