Re: number_format
| From: | Stut | Date: | Tue, 30 May 2006 20:47:25 +0000 |
| Subject: | Re: number_format | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-237109@lists.php.net to get a copy of this message | ||
João Cândido de Souza Neto wrote:
If you look at carefuly, you´ll see that i´ve two problems in the same function. 1 - This function add blank spaces at the beginning of the string. 2 - This function rounds the $var value and it can causes meny troubles.Ok, I've already checked that number_format will not output spaces based on the calls you gave. Here's that script since it seems you don't believe me - try it yourself... <?php // This tests whether number_format is adding spaces print "'".number_format("3000",2,",",".")."'\n"; print "'".number_format("300",2,",",".")."'\n"; ?> As for the rounding thing, it does appear that number_format will round the number before displaying it. To avoid this you'll need to manipulate the number using the string functions. -Stut PS. Please do not just reply to me directly.