Re: number_format
| From: | Jo�o C�ndido de Souza Neto | Date: | Tue, 30 May 2006 21:00:24 +0000 |
| Subject: | Re: number_format | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-237110@lists.php.net to get a copy of this message | ||
I´m sorry.
My head´s crazy todar.
Thanks a lot.
"Stut" <stuttle@gmail.com> escreveu na mensagem
news:447CAF5D.8040601@gmail.com...
> 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.