RE: [PHP-WIN] RE: decimal numbers

From: Date: Wed, 10 Jan 2001 16:27:10 +0000
Subject: RE: [PHP-WIN] RE: decimal numbers
Groups: php.windows 
Request: Send a blank email to php-windows+get-4905@lists.php.net to get a copy of this message
> You need to use sprintf or printf to format the output. Here's the > necessary code: > $Percent = sprintf ("%0.2f", $Percent); > If you use printf it will print the result, whereas sprintf > (as used above) returns the string and lets you assign it to a variable > instead. > More info here: http://www.php.net/manual/function.sprintf.php Or you can use number_format() and you won't have to remember all those printf() formatting strings... :p Chris

« previous php.windows (#4905) next »