changed number_format function
| From: | Ma SivaKumar | Date: | Fri, 27 Aug 2004 08:36:56 +0000 |
| Subject: | changed number_format function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-194911@lists.php.net to get a copy of this message | ||
A copy of php manual I downloaded a year back
has the following about the behaviour of
number_format function
<?php
$number = 1234.56;
// english notation (default)
$english_format_number =
number_format($number);
// 1,234.56
?>
The latest on-line version is changed as
below
<?php
$number = 1234.56;
// english notation (default)
$english_format_number =
number_format($number);
// 1,234
In many un-updated sites I could see the old
version. I am not successful finding the
change log related to this.
Does any one know why it is changed thus?
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.
I am looking at sprintf now.
Thanks and Best regards,
Ma SivaKumar