Re: newbie question

From: Date: Sun, 12 Oct 2003 16:29:51 +0000
Subject: Re: newbie question
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-165908@lists.php.net to get a copy of this message
On Sun, 2003-10-12 at 12:19, Wang Feng wrote: > I think, without any help, the only way to make it clear is to read the > source code of that function in php. The manual doesn't explain the function > well. > > But I'm sure many people here knows the answer well. Come on. Where are you? I believe the documentation (in at least on of the ?printf() functions describes how the implementation follows the C specs. I'm pretty sure the ?printf() family of functions were added almost entirely for the benefit of C coders :) Cheers, Rob. > > > cheers, > > feng > > > > ----- Original Message ----- > From: "Curt Zirzow" <php-general@zirzow.dyndns.org> > To: <php-general@lists.php.net> > Sent: Monday, October 13, 2003 2:01 AM > Subject: Re: [PHP] newbie question > > > > * Thus wrote Eugene Lee (list-php-1@fsck.net): > > > On Sun, Oct 12, 2003 at 06:57:35PM +1000, Wang Feng wrote: > > > : > > > : If I get rid of the 0 and tried this: > > > : > > > : $price=.65; > > > : $f_price=sprintf("%1.2f",$price); > > > : > > > : It displays "0.65" in my Mozilla browser correctly. What do you say > then? > > > > > > I say, "I dunno". :-) It seems to follow C's printf(3) conversion > > > specification. If a decimal point is needed for a float, it must also > > > have a digit in front of the decimal point. This is kind of annoying if > > > I want to print decimal-only values without preceding zeroes. Maybe > > > money_format() is a better solution. > > > > yep, and even "%0.2f" yields 0.65 > > > > > > Curt > > -- > > "My PHP key is worn out" > > > > PHP List stats since 1997: > > http://zirzow.dyndns.org/html/mlists/ > > > > -- > > 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 > > -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

« previous php.general (#165908) next »