On Mon, 2003-06-09 at 15:22, Dan Anderson wrote: > Is it possible to tell PHP when converting a number to a string (i.e. in > an echo or print command) to use x decimal places? > > Specifically, if I > > <?php > echo '$' . $some_price; > ?> > > And some_price is $1.50, it outputs: > > $1.5 > > Thanks in advance, > > Dan
http://ca2.php.net/manual/en/function.number-format.php ...i.e.: <?php error_reporting(E_ALL); $someValue = 1.50; echo '$' . number_format($someValue, 2) . "\n" ?> Hope this helps, Torben -- Torben Wilson <[EMAIL PROTECTED]> +1.604.709.0506 http://www.thebuttlesschaps.com http://www.inflatableeye.com http://www.hybrid17.com http://www.themainonmain.com -----==== Boycott Starbucks! http://www.haidabuckscafe.com ====----- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php