> 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
- [PHP-WIN] RE: decimal numbers Simon Willison
- Boget, Chris