Re: changed number_format function
| From: | Ramil Sagum | Date: | Fri, 27 Aug 2004 08:53:33 +0000 |
| Subject: | Re: changed number_format function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-194912@lists.php.net to get a copy of this message | ||
On Fri, 27 Aug 2004 14:06:56 +0530, Ma SivaKumar <tech@leatherlink.net> wrote:
>
> The latest on-line version is changed as
> below
> <?php
> $number = 1234.56;
> // english notation (default)
> $english_format_number =
> number_format($number);
> // 1,234
>
> What is the best way to format numbers to put
> only the thousand separator without removing
> or adding decimal places to the number.
>
> For example,
>
> 1000 should return 1,000
> 1000.5 should return 1,000.5
> 1000.25 should return 1,000.25
> so on.
>
>
> Ma SivaKumar
Thus says http://www.php.net/number_format
string number_format ( float number [, int decimals])
string number_format ( float number, int decimals, string dec_point,
string thousands_sep)
.
.
.
If two parameters are given, number will be formatted with decimals
decimals with a dot (".") in front, and a comma (",") between every
group of thousands.
----
ramil
http://ramil.sagum.net