Re: note 27915 added to function.printf

From: Date: Tue, 24 Dec 2002 20:49:29 +0000
Subject: Re: note 27915 added to function.printf
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-41269@lists.php.net to get a copy of this message
Perhaps you were not aware of number_format() (in PHP for some years now), as well as the more recent money_format() function (in CVS not documented yet). I added an editor's note to that respect to your contribution. Let me know if you want the note re-edited, removed, etc. --- gwang@structure-tech.com wrote: > The following function can print out good format > digit. > like $123,456.00 > #!/usr/local/bin/php > <?php > function goodlookingnumber($f) > { > $r = ""; > $r = round(fmod($f, 1000), 2); > while ($f>1000){ > $f = $f/1000; > $r = round(fmod($f, 1000), 0) . ",". > $r; > } > > return $r; > } > $ff = 123456789.129456778; > echo $ff."\n"; > > echo "$".goodlookingnumber($ff) . "\n"; > > ?> > -- > http://www.php.net/manual/en/function.printf.php > http://master.php.net/manage/user-notes.php?action=edit+27915 > http://master.php.net/manage/user-notes.php?action=delete+27915 > http://master.php.net/manage/user-notes.php?action=reject+27915 > > > -- > PHP Notes Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > ===== --- Jesus M. Castagnetto <jmcastagnetto@php.net> __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com

« previous php.notes (#41269) next »