RE: Currency and number types...

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

 



number_format() is what you need

look it up

bastien

From: Mark Benson <markbenson@xxxxxxx>
To: php-db@xxxxxxxxxxxxx
Subject:  Currency and number types...
Date: Fri, 19 Nov 2004 17:35:53 +0000

I'm trying to display data calculated by my script as a currency. The problem I have is that PHP is treating the results of the math as a 'float' number (or 'double') so I am getting results like:

12.0594393

in my table. I have tried using:

print round($foobar,2)

but that cuts off the trailing zero on numbers that comne out as, for example '12.10' or '12.00'.

Does anyone know a way to force PHP to print numbers to a set number of significant figures (i.e. 2) and stop the trailing zero suppression?

--
Mark Benson

http://homepage.mac.com/markbenson

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


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux