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


Groups > comp.lang.php > #9264 > unrolled thread

bug in is_numeric

Started byfred <email@address.com>
First post2013-05-12 15:22 +0100
Last post2013-05-15 13:11 +0200
Articles 20 on this page of 141 — 20 participants

Back to article view | Back to comp.lang.php


Contents

  bug in  is_numeric fred <email@address.com> - 2013-05-12 15:22 +0100
    Re: bug in  is_numeric Salvatore <sal@yojimbo.hack.invalid> - 2013-05-12 15:31 +0000
      Re: bug in  is_numeric Luuk <luuk@invalid.lan> - 2013-05-12 17:55 +0200
      Re: bug in  is_numeric Luuk <luuk@invalid.lan> - 2013-05-12 17:58 +0200
      Re: bug in  is_numeric Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2013-05-12 18:06 +0200
      Re: bug in  is_numeric Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-12 16:24 +0000
      Re: bug in  is_numeric fred <email@address.com> - 2013-05-12 18:41 +0100
        Re: bug in  is_numeric Erwin Moller <erwinmollerusenet@xs4all.nl> - 2013-05-13 13:50 +0200
          Re: bug in  is_numeric fred <email@address.com> - 2013-05-13 14:58 +0100
            Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-13 10:11 -0400
              Re: bug in  is_numeric fred <email@address.com> - 2013-05-13 15:15 +0100
                Re: bug in  is_numeric Erwin Moller <erwinmollerusenet@xs4all.nl> - 2013-05-13 17:29 +0200
                Re: bug in  is_numeric "J.O. Aho" <user@example.net> - 2013-05-13 19:55 +0200
                Re: bug in  is_numeric Richard Yates <richard@yatesguitar.com> - 2013-05-14 06:41 -0700
                  Re: bug in  is_numeric SwissCheese <swisscheese@cfl.rr.com> - 2013-05-14 21:43 -0400
                    Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-14 23:01 -0400
                      Re: bug in  is_numeric SwissCheese <swisscheese@cfl.rr.com> - 2013-05-15 05:48 -0400
                        Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-15 06:11 -0400
                          Re: bug in  is_numeric SwissCheese <swisscheese@cfl.rr.com> - 2013-05-16 18:36 -0400
                        Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-15 15:19 +0200
                          Re: bug in  is_numeric Christoph Becker <cmbecker69@gmx.de> - 2013-05-15 20:23 +0200
                            Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-15 20:49 +0200
                              Re: bug in  is_numeric Christoph Becker <cmbecker69@gmx.de> - 2013-05-15 21:58 +0200
                                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-15 22:20 +0200
                                  Re: bug in  is_numeric Christoph Becker <cmbecker69@gmx.de> - 2013-05-15 22:42 +0200
                                Re: bug in  is_numeric Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2013-05-15 23:53 +0200
                                  Re: bug in  is_numeric Christoph Becker <cmbecker69@gmx.de> - 2013-05-16 00:29 +0200
                                    Re: bug in  is_numeric Christoph Becker <cmbecker69@gmx.de> - 2013-05-16 00:40 +0200
                                    Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-16 05:00 +0200
                              Re: bug in  is_numeric SwissCheese <swisscheese@cfl.rr.com> - 2013-05-16 18:16 -0400
                                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-17 00:45 +0200
                                  Re: bug in  is_numeric SwissCheese <swisscheese@cfl.rr.com> - 2013-05-16 22:52 -0400
                                    Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-17 18:33 +0200
                                      Re: bug in  is_numeric Christoph Becker <cmbecker69@gmx.de> - 2013-05-17 20:39 +0200
                                        Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-17 23:45 +0200
                                          Re: bug in  is_numeric Christoph Becker <cmbecker69@gmx.de> - 2013-05-18 14:47 +0200
                      Re: bug in  is_numeric SwissCheese <swisscheese@cfl.rr.com> - 2013-05-15 20:57 -0400
                        Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-16 00:09 -0400
                          Re: bug in  is_numeric Christoph Becker <cmbecker69@gmx.de> - 2013-05-17 01:17 +0200
                            Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-16 20:30 -0400
                              Re: bug in  is_numeric Christoph Becker <cmbecker69@gmx.de> - 2013-05-18 14:51 +0200
                                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-18 10:07 -0400
                                  Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-18 11:56 -0500
                                    Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-18 14:32 -0400
                                      Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-18 22:24 +0200
                                        Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-18 17:01 -0400
                                      Re: bug in  is_numeric Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-18 21:58 +0000
                                        Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-18 19:21 -0400
                                          Re: bug in  is_numeric Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-19 02:22 +0000
                                            Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-18 22:41 -0400
                                              Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 05:28 -0500
                                                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-19 09:42 -0400
                                                  Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 11:42 -0500
                                                    Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-19 14:39 -0400
                                                      Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-21 01:01 -0500
                                                        Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-21 05:59 -0400
                                            Re: bug in  is_numeric The Natural Philosopher <tnp@invalid.invalid> - 2013-05-19 07:49 +0100
                                              Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 05:31 -0500
                                                Re: bug in  is_numeric The Natural Philosopher <tnp@invalid.invalid> - 2013-05-19 12:39 +0100
                                                  Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-19 09:43 -0400
                                                    Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 11:52 -0500
                                                      Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-19 14:42 -0400
                                                        Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-21 01:03 -0500
                                                          Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-21 06:00 -0400
                                                  Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 11:45 -0500
                                          Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 05:27 -0500
                                            Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-19 09:45 -0400
                                              Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 11:37 -0500
                                                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-19 14:43 -0400
                                                  Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-21 00:59 -0500
                                                    Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-21 06:02 -0400
                                      Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-18 17:08 -0500
                                        Re: bug in  is_numeric The Natural Philosopher <tnp@invalid.invalid> - 2013-05-18 23:58 +0100
                                        Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-18 19:22 -0400
                                      Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-18 17:11 -0500
                                        Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-18 19:23 -0400
                                          Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 05:35 -0500
                                            Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-19 09:46 -0400
                                              Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 11:23 -0500
                                                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-19 14:44 -0400
                                                  Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-21 00:54 -0500
                                                    Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-21 06:03 -0400
                                                      Re: bug in  is_numeric fred <email@address.com> - 2013-05-23 15:38 +0100
                                                      Re: bug in  is_numeric Arno Welzel <usenet@arnowelzel.de> - 2013-06-01 17:36 +0200
                                                        Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-01 14:54 -0400
                                                          Re: bug in  is_numeric Arno Welzel <usenet@arnowelzel.de> - 2013-06-05 15:25 +0200
                                                            Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-05 10:34 -0400
                                                              Re: bug in  is_numeric Arno Welzel <usenet@arnowelzel.de> - 2013-06-05 17:02 +0200
                                                                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-05 12:30 -0400
                                                                  OT: What you say is not always what you mean (was: Re: bug in  is_numeric) Arno Welzel <usenet@arnowelzel.de> - 2013-06-05 20:20 +0200
                                                                    Re: OT: What you say is not always what you mean Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-05 14:40 -0400
                                    Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-18 21:51 +0200
                                      Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-18 17:13 -0500
                                        Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-19 00:49 +0200
                                          Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 05:24 -0500
                                            Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-19 12:40 +0200
                                              Re: bug in  is_numeric The Natural Philosopher <tnp@invalid.invalid> - 2013-05-19 12:43 +0100
                                              Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 11:29 -0500
                                  Re: bug in  is_numeric Norman Peelman <npeelman@cfl.rr.com> - 2013-05-18 14:53 -0400
                      Re: bug in  is_numeric SwissCheese <swisscheese@cfl.rr.com> - 2013-05-16 18:41 -0400
            Re: bug in  is_numeric Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-05-13 08:35 -0700
            Re: bug in  is_numeric Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-13 20:26 +0000
        Re: bug in  is_numeric Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-13 20:15 +0000
      Re: bug in  is_numeric Robert Heller <heller@deepsoft.com> - 2013-05-12 13:03 -0500
    Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-12 18:03 +0200
      Re: bug in  is_numeric fred <email@address.com> - 2013-05-12 18:34 +0100
        Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-12 19:40 +0200
          Re: bug in  is_numeric Luuk <luuk@invalid.lan> - 2013-05-12 21:51 +0200
    Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-12 11:47 -0500
      Re: bug in  is_numeric Luuk <luuk@invalid.lan> - 2013-05-12 18:56 +0200
      Re: bug in  is_numeric Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2013-05-12 19:05 +0200
        Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-12 19:38 +0200
          Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-12 19:46 +0200
          Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-12 14:11 -0400
            Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-12 20:39 +0200
              Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-12 16:51 -0400
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-13 01:27 +0200
                  Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-12 20:35 -0400
                    Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-13 11:07 +0200
                      Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-13 09:02 -0400
                        Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-13 16:57 +0200
                          Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-13 17:10 +0200
                          Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-13 13:52 -0400
                            Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-13 20:28 +0200
                      Re: bug in  is_numeric SwissCheese <swisscheese@cfl.rr.com> - 2013-05-16 18:28 -0400
                        Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-17 00:33 +0200
                          Re: bug in  is_numeric SwissCheese <swisscheese@cfl.rr.com> - 2013-05-16 22:34 -0400
                            Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-18 10:28 +0200
                              Re: bug in  is_numeric Norman Peelman <npeelman@cfl.rr.com> - 2013-05-18 08:00 -0400
                                Re: bug in  is_numeric Luuk <luuk@invalid.lan> - 2013-05-18 14:18 +0200
                                Re: bug in  is_numeric Tim Streater <timstreater@greenbee.net> - 2013-05-18 13:20 +0100
                                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-18 08:47 -0400
                                Re: bug in  is_numeric The Natural Philosopher <tnp@invalid.invalid> - 2013-05-18 14:05 +0100
                                  Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-18 10:16 -0400
                                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-18 16:14 +0200
    Re: bug in  is_numeric Sandman <mr@sandman.net> - 2013-05-14 10:34 +0200
      Re: bug in  is_numeric fred <email@address.com> - 2013-05-14 14:47 +0100
        Re: bug in  is_numeric Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-14 14:54 +0000
        Re: bug in  is_numeric Sandman <mr@sandman.net> - 2013-05-15 08:05 +0200
          Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-15 06:27 -0400
            Re: bug in  is_numeric Erwin Moller <erwinmollerusenet@xs4all.nl> - 2013-05-15 13:11 +0200

Page 1 of 8  [1] 2 3 4 5 6 7 8  Next page →


#9264 — bug in is_numeric

Fromfred <email@address.com>
Date2013-05-12 15:22 +0100
Subjectbug in is_numeric
Message-ID<MPG.2bf9b5f139f7cb7d9896aa@news.virginmedia.com>



Using PHP 5.3.6 on win7-74

if(is_numeric('x11.11c')  returns  TRUE
and variations eg: z1111x is also true

this does not seem right to me.
I've done a search but cant find mention in buglist.

Perhaps someone more knowledgable can deal with this.
I've tried to mention elsewhere but PHP.net seems to be going
out of its way to make life impossible
 

[toc] | [next] | [standalone]


#9265

FromSalvatore <sal@yojimbo.hack.invalid>
Date2013-05-12 15:31 +0000
Message-ID<kmocju$232o$1@yojimbo.hack>
In reply to#9264
On 2013-05-12, fred <email@address.com> wrote:
> Using PHP 5.3.6 on win7-74
>
> if(is_numeric('x11.11c')  returns  TRUE
> and variations eg: z1111x is also true
>
> this does not seem right to me.
> I've done a search but cant find mention in buglist.
>
> Perhaps someone more knowledgable can deal with this.
> I've tried to mention elsewhere but PHP.net seems to be going
> out of its way to make life impossible
>  

You are correct. That parameter, when passed to is_numeric(), should
return false. I tried it on Mac OS X and FreeBSD, but not on Windows.

Could you try the following code and let me know what comes out?

<?php $a = is_numeric('x11.11c'); var_dump($a); ?>


-- 
Blah blah bleh...
GCS/CM d(-)@>-- s+:- !a C++$ UBL++++$ L+$ W+++$ w M++ Y++ b++

[toc] | [prev] | [next] | [standalone]


#9266

FromLuuk <luuk@invalid.lan>
Date2013-05-12 17:55 +0200
Message-ID<7kq46a-cfm.ln1@luuk.invalid.lan>
In reply to#9265
On 12-05-2013 17:31, Salvatore wrote:
> On 2013-05-12, fred <email@address.com> wrote:
>> Using PHP 5.3.6 on win7-74
>>
>> if(is_numeric('x11.11c')  returns  TRUE
>> and variations eg: z1111x is also true
>>
>> this does not seem right to me.
>> I've done a search but cant find mention in buglist.
>>
>> Perhaps someone more knowledgable can deal with this.
>> I've tried to mention elsewhere but PHP.net seems to be going
>> out of its way to make life impossible
>>
>
> You are correct. That parameter, when passed to is_numeric(), should
> return false. I tried it on Mac OS X and FreeBSD, but not on Windows.
>
> Could you try the following code and let me know what comes out?
>
> <?php $a = is_numeric('x11.11c'); var_dump($a); ?>
>
>

C:\temp>ver

Microsoft Windows [Version 6.1.7601]

C:\temp>php -v
PHP 5.4.13 (cli) (built: Mar 15 2013 02:07:14)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

C:\temp>type test.php
<?php $a = is_numeric('x11.11c'); var_dump($a); ?>
C:\temp>php test.php
bool(false)

C:\temp>

[toc] | [prev] | [next] | [standalone]


#9267

FromLuuk <luuk@invalid.lan>
Date2013-05-12 17:58 +0200
Message-ID<7qq46a-cfm.ln1@luuk.invalid.lan>
In reply to#9265
On 12-05-2013 17:31, Salvatore wrote:
> On 2013-05-12, fred <email@address.com> wrote:
>> Using PHP 5.3.6 on win7-74
>>
>> if(is_numeric('x11.11c')  returns  TRUE
>> and variations eg: z1111x is also true
>>
>> this does not seem right to me.
>> I've done a search but cant find mention in buglist.
>>
>> Perhaps someone more knowledgable can deal with this.
>> I've tried to mention elsewhere but PHP.net seems to be going
>> out of its way to make life impossible
>>
>
> You are correct. That parameter, when passed to is_numeric(), should
> return false. I tried it on Mac OS X and FreeBSD, but not on Windows.
>
> Could you try the following code and let me know what comes out?
>
> <?php $a = is_numeric('x11.11c'); var_dump($a); ?>
>
>

luuk@opensuse:~/tmp> php test.php
bool(false)
luuk@opensuse:~/tmp>

(just to make it complete)

[toc] | [prev] | [next] | [standalone]


#9269

FromThomas Mlynarczyk <thomas@mlynarczyk-webdesign.de>
Date2013-05-12 18:06 +0200
Message-ID<kmoele$459$1@news.albasani.net>
In reply to#9265
Salvatore schrieb:

> Could you try the following code and let me know what comes out?
> <?php $a = is_numeric('x11.11c'); var_dump($a); ?>

Windows XP, PHP 5.2.4  -- false
Windows XP, PHP 5.2.12 -- false
Windows XP, PHP 5.3.2  -- false
Windows XP, PHP 5.3.18 -- false
Windows XP, PHP 5.4.8  -- false

Greetings,
Thomas

-- 
Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)

[toc] | [prev] | [next] | [standalone]


#9270

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2013-05-12 16:24 +0000
Message-ID<kmofni$gbe$2@dont-email.me>
In reply to#9265
On Sun, 12 May 2013 15:31:10 +0000, Salvatore wrote:

> Could you try the following code and let me know what comes out?
> 
> <?php $a = is_numeric('x11.11c'); var_dump($a); ?>

$ ./test_numeric.php
string(105) "#!/usr/bin/php
<?php
var_dump( file_get_contents( __FILE__ ) );
var_dump( is_numeric( 'x11.11c' ) );
?>

"
bool(false)

$ php --version
PHP 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli) (built: Mar 11 2013 
14:31:48) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH
$ uname -r
3.2.0-41-generic
$ cat /etc/issue
Ubuntu 12.04.2 LTS \n \l

$ 

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [prev] | [next] | [standalone]


#9277

Fromfred <email@address.com>
Date2013-05-12 18:41 +0100
Message-ID<MPG.2bf9e49c5e796889896ac@news.virginmedia.com>
In reply to#9265
In article <kmocju$232o$1@yojimbo.hack>, sal@yojimbo.hack.invalid 
says...
> You are correct. That parameter, when passed to is_numeric(), should
> return false. I tried it on Mac OS X and FreeBSD, but not on Windows.
> 
> Could you try the following code and let me know what comes out?
>  <?php $a = is_numeric('x11.11c'); var_dump($a); ?>

Hi sal

OK I get false when I do that.
"bool(false)" to be more precise.
var_export($a)also reports false if thats any help.

 

[toc] | [prev] | [next] | [standalone]


#9288

FromErwin Moller <erwinmollerusenet@xs4all.nl>
Date2013-05-13 13:50 +0200
Message-ID<5190d3a0$0$15991$e4fe514c@news2.news.xs4all.nl>
In reply to#9277
On 5/12/2013 7:41 PM, fred wrote:
> In article <kmocju$232o$1@yojimbo.hack>, sal@yojimbo.hack.invalid
> says...
>> You are correct. That parameter, when passed to is_numeric(), should
>> return false. I tried it on Mac OS X and FreeBSD, but not on Windows.
>>
>> Could you try the following code and let me know what comes out?
>>   <?php $a = is_numeric('x11.11c'); var_dump($a); ?>
>
> Hi sal
>
> OK I get false when I do that.
> "bool(false)" to be more precise.
> var_export($a)also reports false if thats any help.
>
>

Hi Fred,

So on your current set-up is_numeric() seems to work fine.
It returns false, as expected.

But you claimed in your original post, the test returned true.
I am confused now. :-)

Could you give us the (relevant) code that made you  make your first claim?
I expect it does something else than you think it does.

Regards,
Erwin Moller


-- 
"That which can be asserted without evidence, can be dismissed without 
evidence."
-- Christopher Hitchens

[toc] | [prev] | [next] | [standalone]


#9295

Fromfred <email@address.com>
Date2013-05-13 14:58 +0100
Message-ID<MPG.2bfb01d2b1e6b24f9896af@news.virginmedia.com>
In reply to#9288
In article <5190d3a0$0$15991$e4fe514c@news2.news.xs4all.nl>, 
erwinmollerusenet@xs4all.nl says...
> So on your current set-up is_numeric() seems to work fine.
> It returns false, as expected.
> 

No. 
is_numeric() returns true.
It was var_dump() that reurned false.

> But you claimed in your original post, the test returned true.
> I am confused now. :-)

Yes you are confused. 

> Could you give us the (relevant) code that made you  make your first > 
> claim?

$a = 'x11.11c';
if(is_numeric($a)) { echo('oops - a problem' . '<BR>') } ; 

> I expect it does something else than you think it does.

What it does is something that I didn't think right - as stated.

[toc] | [prev] | [next] | [standalone]


#9296

FromJerry Stuckle <jstucklex@attglobal.net>
Date2013-05-13 10:11 -0400
Message-ID<kmqs3c$e3s$1@dont-email.me>
In reply to#9295
On 5/13/2013 9:58 AM, fred wrote:
> In article <5190d3a0$0$15991$e4fe514c@news2.news.xs4all.nl>,
> erwinmollerusenet@xs4all.nl says...
>> So on your current set-up is_numeric() seems to work fine.
>> It returns false, as expected.
>>
>
> No.
> is_numeric() returns true.
> It was var_dump() that reurned false.
>

As others have shown, is_numeric() returns false in several versions of PHP.

>> But you claimed in your original post, the test returned true.
>> I am confused now. :-)
>
> Yes you are confused.
>
>> Could you give us the (relevant) code that made you  make your first >
>> claim?
>
> $a = 'x11.11c';
> if(is_numeric($a)) { echo('oops - a problem' . '<BR>') } ;
>
>> I expect it does something else than you think it does.
>
> What it does is something that I didn't think right - as stated.
>

Is that cut and paste of your actual code?  Is it your entire code?

What happens with the following code:

echo is_numeric('x11.11c') ? 'true' : 'false';




-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#9297

Fromfred <email@address.com>
Date2013-05-13 15:15 +0100
Message-ID<MPG.2bfb05badc66f3d69896b0@news.virginmedia.com>
In reply to#9296
In article <kmqs3c$e3s$1@dont-email.me>, jstucklex@attglobal.net says...
> As others have shown, is_numeric() returns false in several versions of PHP.
> 

I have just typed in an exact copy of the test in my message of 02:58pm
When you have run that on an apache PHP installation of the same version 
PHP as I listed (5.3.6) under windows7-64 bit - get back to me.

Otherwise I'm done repeating myself.

[toc] | [prev] | [next] | [standalone]


#9302

FromErwin Moller <erwinmollerusenet@xs4all.nl>
Date2013-05-13 17:29 +0200
Message-ID<519106e7$0$15952$e4fe514c@news2.news.xs4all.nl>
In reply to#9297
On 5/13/2013 4:15 PM, fred wrote:
> In article <kmqs3c$e3s$1@dont-email.me>, jstucklex@attglobal.net says...
>> As others have shown, is_numeric() returns false in several versions of PHP.
>>
>
> I have just typed in an exact copy of the test in my message of 02:58pm
> When you have run that on an apache PHP installation of the same version
> PHP as I listed (5.3.6) under windows7-64 bit - get back to me.
>
> Otherwise I'm done repeating myself.
>
>

Dear Fred,

The problem is this: You claim that your tests return true AND false.
That is why I am confused, and propably most readers in here.

You claim (in your original posting) that
if(is_numeric('x11.11c'))
returns  TRUE

And you also claim that the test Salvatore suggested returns false:
<?php $a = is_numeric('x11.11c'); var_dump($a); ?>
That results in false, you posted.

Do you see the problem?

Same string ('x11.11c'), same function is_numeric, but different results.

So no need to repeat yourself, but at least take the time to look into 
this problem.

I bet your code tests something else than you think it tests.
For example a row from a query, which you misinterpret, or a false 
result that you juggle into a number, etc.etc.

eg: Some db-problem -> row is false -> you juggle false into 0, and test 
if 0 is numeric.

There are many common mistakes possible, and some people in here can 
spot them right away (because they made the same mistakes themself earlier).

Hence the question if you can post more ACTUAL code.
You showed yourself that the function is_numeric WORKS on your system by 
posting the result of Salvatore's test.


Regards,
Erwin Moller


-- 
"That which can be asserted without evidence, can be dismissed without 
evidence."
-- Christopher Hitchens

[toc] | [prev] | [next] | [standalone]


#9305

From"J.O. Aho" <user@example.net>
Date2013-05-13 19:55 +0200
Message-ID<avcnnlFb0kdU1@mid.individual.net>
In reply to#9297
On 13/05/13 16:15, fred wrote:

> Otherwise I'm done repeating myself.
> > > if(is_numeric('x11.11c')  returns  TRUE
> > > and variations eg: z1111x is also true
 > >
> > Could you try the following code and let me know what comes out?
> >  <?php $a = is_numeric('x11.11c'); var_dump($a); ?>
>
> OK I get false when I do that.
> "bool(false)" to be more precise.
> var_export($a)also reports false if thats any help.
>
> I have just typed in an exact copy of the test in my message of 02:58pm
> When you have run that on an apache PHP installation of the same version
> PHP as I listed (5.3.6) under windows7-64 bit - get back to me.

Apparently there is nothing wrong with your is_numeric() as you state 
var_export did return "bool(false)" which is the expected result.

you fail to show the code you actually used (the example you gave don't 
have correct syntax, so I doubt it's from your actual code, just 
something you wrote).

As other already pointed out, you are most likely expecting a specific 
value to been set, but most likely it's another value (bad coding which 
uses "global" values which are used in many functions will in most cases 
have a more random nature of what value it will have) or that your 
if-statement includes a negation for example:

if(!is_numeric("abcdef")) {
	echo "my code is buggy, not is_numeric()\n";
}

By the way, var_export() don't return false, it will return null by 
default or a string (if you set the return argument to true).
If you made a check on what var_export() returned and you got it to be 
equal to false, then your method of checking the return value is utterly 
flawed.

The release of PHP 5.3.6 is over two years ago, and if there had been a 
bug, then it had been discovered a lot earlier than now on a function 
which is heavily used in a lot of PHP code and the code base isn't 
platform dependent.

My recommendation would be to upgrade to 5.4.14, if you can't find it 
for your OS, then upgrade to one which provides it.

-- 

  //Aho



[toc] | [prev] | [next] | [standalone]


#9324

FromRichard Yates <richard@yatesguitar.com>
Date2013-05-14 06:41 -0700
Message-ID<jif4p8lqcjcin9inpluivhc8rcj96qn21d@4ax.com>
In reply to#9297
On Mon, 13 May 2013 15:15:06 +0100, fred <email@address.com> wrote:

>In article <kmqs3c$e3s$1@dont-email.me>, jstucklex@attglobal.net says...
>> As others have shown, is_numeric() returns false in several versions of PHP.
>> 
>
>I have just typed in an exact copy of the test in my message of 02:58pm
>When you have run that on an apache PHP installation of the same version 
>PHP as I listed (5.3.6) under windows7-64 bit - get back to me.
>
>Otherwise I'm done repeating myself.
>

<?php 
$a = 'x11.11c';
if(is_numeric($a)) { echo 'oops - a problem'; } else { echo 'okay'; } 
?>

Prints 'okay'

Windows 7 Home Premium 64 bit, PHP5.3.4, Apache2.2.17, (WAMP)

[toc] | [prev] | [next] | [standalone]


#9331

FromSwissCheese <swisscheese@cfl.rr.com>
Date2013-05-14 21:43 -0400
Message-ID<kmup14$3cp$2@dont-email.me>
In reply to#9324
On 05/14/2013 09:41 AM, Richard Yates wrote:
> On Mon, 13 May 2013 15:15:06 +0100, fred <email@address.com> wrote:
>
>> In article <kmqs3c$e3s$1@dont-email.me>, jstucklex@attglobal.net says...
>>> As others have shown, is_numeric() returns false in several versions of PHP.
>>>
>>
>> I have just typed in an exact copy of the test in my message of 02:58pm
>> When you have run that on an apache PHP installation of the same version
>> PHP as I listed (5.3.6) under windows7-64 bit - get back to me.
>>
>> Otherwise I'm done repeating myself.
>>
>
> <?php
> $a = 'x11.11c';
> if(is_numeric($a)) { echo 'oops - a problem'; } else { echo 'okay'; }
> ?>
>
> Prints 'okay'
>
> Windows 7 Home Premium 64 bit, PHP5.3.4, Apache2.2.17, (WAMP)
>

   That's backwards... you want:

$a = 'x11.11c';
if(is_numeric($a)) { echo 'ok'; } else { echo 'not okay'; }

Sorry, hit send too quick!

-- 
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-

[toc] | [prev] | [next] | [standalone]


#9332

FromJerry Stuckle <jstucklex@attglobal.net>
Date2013-05-14 23:01 -0400
Message-ID<kmutiq$ld3$1@dont-email.me>
In reply to#9331
On 5/14/2013 9:43 PM, SwissCheese wrote:
> On 05/14/2013 09:41 AM, Richard Yates wrote:
>> On Mon, 13 May 2013 15:15:06 +0100, fred <email@address.com> wrote:
>>
>>> In article <kmqs3c$e3s$1@dont-email.me>, jstucklex@attglobal.net says...
>>>> As others have shown, is_numeric() returns false in several versions
>>>> of PHP.
>>>>
>>>
>>> I have just typed in an exact copy of the test in my message of 02:58pm
>>> When you have run that on an apache PHP installation of the same version
>>> PHP as I listed (5.3.6) under windows7-64 bit - get back to me.
>>>
>>> Otherwise I'm done repeating myself.
>>>
>>
>> <?php
>> $a = 'x11.11c';
>> if(is_numeric($a)) { echo 'oops - a problem'; } else { echo 'okay'; }
>> ?>
>>
>> Prints 'okay'
>>
>> Windows 7 Home Premium 64 bit, PHP5.3.4, Apache2.2.17, (WAMP)
>>
>
>    That's backwards... you want:
>
> $a = 'x11.11c';
> if(is_numeric($a)) { echo 'ok'; } else { echo 'not okay'; }
>
> Sorry, hit send too quick!
>

No, Richard had it correct.  The if statement returns false, which is 
'ok'.  Your code would return 'not ok' - which is incorrect.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#9340

FromSwissCheese <swisscheese@cfl.rr.com>
Date2013-05-15 05:48 -0400
Message-ID<kmvlet$o6o$1@dont-email.me>
In reply to#9332
On 05/14/2013 11:01 PM, Jerry Stuckle wrote:
> On 5/14/2013 9:43 PM, SwissCheese wrote:
>> On 05/14/2013 09:41 AM, Richard Yates wrote:
>>> On Mon, 13 May 2013 15:15:06 +0100, fred <email@address.com> wrote:
>>>
>>>> In article <kmqs3c$e3s$1@dont-email.me>, jstucklex@attglobal.net
>>>> says...
>>>>> As others have shown, is_numeric() returns false in several versions
>>>>> of PHP.
>>>>>
>>>>
>>>> I have just typed in an exact copy of the test in my message of 02:58pm
>>>> When you have run that on an apache PHP installation of the same
>>>> version
>>>> PHP as I listed (5.3.6) under windows7-64 bit - get back to me.
>>>>
>>>> Otherwise I'm done repeating myself.
>>>>
>>>
>>> <?php
>>> $a = 'x11.11c';
>>> if(is_numeric($a)) { echo 'oops - a problem'; } else { echo 'okay'; }
>>> ?>
>>>
>>> Prints 'okay'
>>>
>>> Windows 7 Home Premium 64 bit, PHP5.3.4, Apache2.2.17, (WAMP)
>>>
>>
>>    That's backwards... you want:
>>
>> $a = 'x11.11c';
>> if(is_numeric($a)) { echo 'ok'; } else { echo 'not okay'; }
>>
>> Sorry, hit send too quick!
>>
>
> No, Richard had it correct.  The if statement returns false, which is
> 'ok'.  Your code would return 'not ok' - which is incorrect.
>

norman@amd64x2:~$ php -a
Interactive shell

php > $a = 'x';
php > if(is_numeric($a)) { echo 'okay'; } else { echo 'not okay'; }
not okay
php > $a = '11';
php > if(is_numeric($a)) { echo 'okay'; } else { echo 'not okay'; }
okay
php > $a = 'x11.11c';
php > if(is_numeric($a)) { echo 'okay'; } else { echo 'not okay'; }
not okay
php > $a = '0x1111c';
php > if(is_numeric($a)) { echo 'okay'; } else { echo 'not okay'; }
okay


   As per http://us3.php.net/manual/en/function.is-numeric.php :

"Hexadecimal (e.g. 0xf4c3b00c), Binary (e.g. 0b10100111001), Octal (e.g. 
0777) notation is allowed too but only without sign, decimal and 
exponential part."



-- 
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-

[toc] | [prev] | [next] | [standalone]


#9342

FromJerry Stuckle <jstucklex@attglobal.net>
Date2013-05-15 06:11 -0400
Message-ID<kmvmp6$tb7$1@dont-email.me>
In reply to#9340
On 5/15/2013 5:48 AM, SwissCheese wrote:
> On 05/14/2013 11:01 PM, Jerry Stuckle wrote:
>> On 5/14/2013 9:43 PM, SwissCheese wrote:
>>> On 05/14/2013 09:41 AM, Richard Yates wrote:
>>>> On Mon, 13 May 2013 15:15:06 +0100, fred <email@address.com> wrote:
>>>>
>>>>> In article <kmqs3c$e3s$1@dont-email.me>, jstucklex@attglobal.net
>>>>> says...
>>>>>> As others have shown, is_numeric() returns false in several versions
>>>>>> of PHP.
>>>>>>
>>>>>
>>>>> I have just typed in an exact copy of the test in my message of
>>>>> 02:58pm
>>>>> When you have run that on an apache PHP installation of the same
>>>>> version
>>>>> PHP as I listed (5.3.6) under windows7-64 bit - get back to me.
>>>>>
>>>>> Otherwise I'm done repeating myself.
>>>>>
>>>>
>>>> <?php
>>>> $a = 'x11.11c';
>>>> if(is_numeric($a)) { echo 'oops - a problem'; } else { echo 'okay'; }
>>>> ?>
>>>>
>>>> Prints 'okay'
>>>>
>>>> Windows 7 Home Premium 64 bit, PHP5.3.4, Apache2.2.17, (WAMP)
>>>>
>>>
>>>    That's backwards... you want:
>>>
>>> $a = 'x11.11c';
>>> if(is_numeric($a)) { echo 'ok'; } else { echo 'not okay'; }
>>>
>>> Sorry, hit send too quick!
>>>
>>
>> No, Richard had it correct.  The if statement returns false, which is
>> 'ok'.  Your code would return 'not ok' - which is incorrect.
>>
>
> norman@amd64x2:~$ php -a
> Interactive shell
>
> php > $a = 'x';
> php > if(is_numeric($a)) { echo 'okay'; } else { echo 'not okay'; }
> not okay
> php > $a = '11';
> php > if(is_numeric($a)) { echo 'okay'; } else { echo 'not okay'; }
> okay
> php > $a = 'x11.11c';
> php > if(is_numeric($a)) { echo 'okay'; } else { echo 'not okay'; }
> not okay
> php > $a = '0x1111c';
> php > if(is_numeric($a)) { echo 'okay'; } else { echo 'not okay'; }
> okay
>
>
>    As per http://us3.php.net/manual/en/function.is-numeric.php :
>
> "Hexadecimal (e.g. 0xf4c3b00c), Binary (e.g. 0b10100111001), Octal (e.g.
> 0777) notation is allowed too but only without sign, decimal and
> exponential part."
>
>
>

Yes, I know how is_numeric() works.  But you don't understand what his 
code was doing.

Saying 'not ok' indicates is_numeric is broken - not that the value is 
not numeric.  is_numeric() is not broken, so saying 'not ok' is the 
incorrect message.

It is not saying the value is numeric.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#9396

FromSwissCheese <swisscheese@cfl.rr.com>
Date2013-05-16 18:36 -0400
Message-ID<kn3mq5$i7q$1@dont-email.me>
In reply to#9342
On 05/15/2013 06:11 AM, Jerry Stuckle wrote:
> On 5/15/2013 5:48 AM, SwissCheese wrote:
>> On 05/14/2013 11:01 PM, Jerry Stuckle wrote:
>>> On 5/14/2013 9:43 PM, SwissCheese wrote:
>>>> On 05/14/2013 09:41 AM, Richard Yates wrote:
>>>>> On Mon, 13 May 2013 15:15:06 +0100, fred <email@address.com> wrote:
>>>>>
>>>>>> In article <kmqs3c$e3s$1@dont-email.me>, jstucklex@attglobal.net
>>>>>> says...
>>>>>>> As others have shown, is_numeric() returns false in several versions
>>>>>>> of PHP.
>>>>>>>
>>>>>>
>>>>>> I have just typed in an exact copy of the test in my message of
>>>>>> 02:58pm
>>>>>> When you have run that on an apache PHP installation of the same
>>>>>> version
>>>>>> PHP as I listed (5.3.6) under windows7-64 bit - get back to me.
>>>>>>
>>>>>> Otherwise I'm done repeating myself.
>>>>>>
>>>>>
>>>>> <?php
>>>>> $a = 'x11.11c';
>>>>> if(is_numeric($a)) { echo 'oops - a problem'; } else { echo 'okay'; }
>>>>> ?>
>>>>>
>>>>> Prints 'okay'
>>>>>
>>>>> Windows 7 Home Premium 64 bit, PHP5.3.4, Apache2.2.17, (WAMP)
>>>>>
>>>>
>>>>    That's backwards... you want:
>>>>
>>>> $a = 'x11.11c';
>>>> if(is_numeric($a)) { echo 'ok'; } else { echo 'not okay'; }
>>>>
>>>> Sorry, hit send too quick!
>>>>
>>>
>>> No, Richard had it correct.  The if statement returns false, which is
>>> 'ok'.  Your code would return 'not ok' - which is incorrect.
>>>
>>
>> norman@amd64x2:~$ php -a
>> Interactive shell
>>
>> php > $a = 'x';
>> php > if(is_numeric($a)) { echo 'okay'; } else { echo 'not okay'; }
>> not okay
>> php > $a = '11';
>> php > if(is_numeric($a)) { echo 'okay'; } else { echo 'not okay'; }
>> okay
>> php > $a = 'x11.11c';
>> php > if(is_numeric($a)) { echo 'okay'; } else { echo 'not okay'; }
>> not okay
>> php > $a = '0x1111c';
>> php > if(is_numeric($a)) { echo 'okay'; } else { echo 'not okay'; }
>> okay
>>
>>
>>    As per http://us3.php.net/manual/en/function.is-numeric.php :
>>
>> "Hexadecimal (e.g. 0xf4c3b00c), Binary (e.g. 0b10100111001), Octal (e.g.
>> 0777) notation is allowed too but only without sign, decimal and
>> exponential part."
>>
>>
>>
>
> Yes, I know how is_numeric() works.  But you don't understand what his
> code was doing.
>
> Saying 'not ok' indicates is_numeric is broken - not that the value is
> not numeric.  is_numeric() is not broken, so saying 'not ok' is the
> incorrect message.
>
> It is not saying the value is numeric.
>

   You know, I've only had to read this post ten times to understand 
what you were saying... ;) My thought was that the output was saying the 
argument was 'ok' (a number) or 'not ok' (not a number'). I did not 
consider the output to be a reflection of the status of is_numeric().

-- 
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-

[toc] | [prev] | [next] | [standalone]


#9351

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2013-05-15 15:19 +0200
Message-ID<9869380.OEKH2unXeN@PointedEars.de>
In reply to#9340
SwissCheese wrote:

> norman@amd64x2:~$ php -a
> Interactive shell
> 
> php > $a = 'x';
> php > if(is_numeric($a)) { echo 'okay'; } else { echo 'not okay'; }
> not okay
> php > $a = '11';
> php > if(is_numeric($a)) { echo 'okay'; } else { echo 'not okay'; }
> okay
> php > $a = 'x11.11c';
> php > if(is_numeric($a)) { echo 'okay'; } else { echo 'not okay'; }
> not okay
> php > $a = '0x1111c';
> php > if(is_numeric($a)) { echo 'okay'; } else { echo 'not okay'; }
> okay
> 
> 
>    As per http://us3.php.net/manual/en/function.is-numeric.php :
> 
> "Hexadecimal (e.g. 0xf4c3b00c), Binary (e.g. 0b10100111001), Octal (e.g.
> 0777) notation is allowed too but only without sign, decimal and
> exponential part."

But AISB, the implementation is contradicting the documentation (or vice-
versa) because the a string argument containing the binary format causes 
is_numeric() to return FALSE in PHP 5.4.4 and PHP 5.4.14 (when according to 
the above it should have returned TRUE).  It is not possible to determine by 
testing whether the octal format is considered numeric because of itself or 
because it is considered decimal.  Incidentally, you have neglected to test 
those two formats.


PointedEars
-- 
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
  -- Richard Cornford, cljs, <cife6q$253$1$8300dec7@news.demon.co.uk> (2004)

[toc] | [prev] | [next] | [standalone]


Page 1 of 8  [1] 2 3 4 5 6 7 8  Next page →

Back to top | Article view | comp.lang.php


csiph-web