Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense [message #177010 is a reply to message #177009] |
Wed, 15 February 2012 21:48 |
M. Strobel
Messages: 386 Registered: December 2011
Karma:
|
Senior Member |
|
|
Am 15.02.2012 21:05, schrieb Michael Fesser:
> .oO(M. Strobel)
>
>> please shed some light on this, it looks like nonsense to me:
>>
>> #------------------
>> strobel@s114-intel:~> php -a
>> Interactive shell
>>
>> php > echo filter_var('456.999', FILTER_SANITIZE_NUMBER_FLOAT);
>> 456999
>> php > echo filter_var('456,999', FILTER_SANITIZE_NUMBER_FLOAT);
>> 456999
>> php >
>> #------------------
>
> This filter has some options you can use (see manual for details):
>
> $ php -r "echo filter_var('456.999', FILTER_SANITIZE_NUMBER_FLOAT,
> FILTER_FLAG_ALLOW_FRACTION);"
> 456.999
>
Oh. The concept of float without fraction is new to me. I would read in an integer
instead.
> $ php -r "echo filter_var('456,999', FILTER_SANITIZE_NUMBER_FLOAT,
> FILTER_FLAG_ALLOW_THOUSAND);"
> 456,999
>
> Micha
>
Hm, it is still messed up, in the default setup it eats points and commas.
/Str.
|
|
|