Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #4827

Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense

From "M. Strobel" <sorry_no_mail_here@nowhere.dee>
Newsgroups comp.lang.php
Subject Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense
Date 2012-02-15 22:48 +0100
Message-ID <9q2nhnFl6dU1@mid.uni-berlin.de> (permalink)
References <9q2dgcF68gU1@mid.uni-berlin.de> <rm3oj7lcbcbq6etokmsbujtu3ildgroist@mfesser.de>

Show all headers | View raw


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.

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

FILTER_SANITIZE_NUMBER_FLOAT non/sense "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-15 19:57 +0100
  Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense Michael Fesser <netizen@gmx.de> - 2012-02-15 21:05 +0100
    Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-15 22:48 +0100
      Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense Michael Fesser <netizen@gmx.de> - 2012-02-15 23:48 +0100
        Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2012-02-16 12:53 +0100
          Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-16 13:34 +0100
            Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense Captain Paralytic <paul_lautman@yahoo.com> - 2012-02-16 04:46 -0800
            Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense Michael Fesser <netizen@gmx.de> - 2012-02-16 13:49 +0100
              Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2012-02-16 14:22 +0100
                Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense Denis McMahon <denismfmcmahon@gmail.com> - 2012-02-16 14:16 +0000
                Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense "Peter H. Coffin" <hellsop@ninehells.com> - 2012-02-16 09:36 -0600
                Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2012-02-16 17:38 +0100
                Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2012-02-16 17:32 +0100
                Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-16 18:02 +0100
                Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense Captain Paralytic <paul_lautman@yahoo.com> - 2012-02-17 03:25 -0800
                Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-17 18:19 +0100
                Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense Captain Paralytic <paul_lautman@yahoo.com> - 2012-02-20 04:31 -0800
                Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense Michael Fesser <netizen@gmx.de> - 2012-02-17 20:35 +0100
                Re: FILTER_SANITIZE_NUMBER_FLOAT non/sense Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-02-20 10:46 +0100

csiph-web