Re: PHP Equivalent of JavaScript whatever.toFixed(2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Arnie Shore wrote:
>> Folks, I need to take a given float value to, say, two decimals, as per
>> subject JS.  I've RTFM, but to no avail.

On Mon, 08 Sep 2008 22:03:54 +0200, Sjoerd wrote:
>$str = sprintf("%01.2f", $number);

Skinning cat, method two:

$str = number_format($number, 2);
-- 
Ross McKay, Toronto, NSW Australia
"Let the laddie play wi the knife - he'll learn"
- The Wee Book of Calvin

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux