Re: changed number_format function

From: Date: Fri, 27 Aug 2004 15:34:02 +0000
Subject: Re: changed number_format function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-194941@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: > 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); number_format($number, 2); > // 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 > -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin--

« previous php.general (#194941) next »