Currency and number types...

From: Date: Fri, 19 Nov 2004 17:35:53 +0000
Subject: Currency and number types...
Groups: php.db 
Request: Send a blank email to php-db+get-37364@lists.php.net to get a copy of this message
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

« previous php.db (#37364) next »