Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense [message #177009 is a reply to message #177007] |
Wed, 15 February 2012 20:05 |
Michael Fesser
Messages: 215 Registered: September 2010
Karma:
|
Senior Member |
|
|
.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
$ php -r "echo filter_var('456,999', FILTER_SANITIZE_NUMBER_FLOAT,
FILTER_FLAG_ALLOW_THOUSAND);"
456,999
Micha
--
http://mfesser.de/blickwinkel
|
|
|