FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » FILTER_SANITIZE_NUMBER_FLOAT non/sense
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense [message #177009 is a reply to message #177007] Wed, 15 February 2012 20:05 Go to previous messageGo to previous message
Michael Fesser is currently offline  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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to start external PHP file from HTML?
Next Topic: DOMDocument HTML problem
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 22:29:03 GMT 2024

Total time taken to generate the page: 0.04086 seconds