Re: [PHP] is_numeric

2005-05-06 Thread Richard Lynch
On Wed, May 4, 2005 3:51 am, pete M said: > not a php expert but have filed this bug report re validating > is_numeric('3e0'); > http://bugs.php.net/bug.php?id=32943 > > Now tried > >function isnumeric($n) { > if (ereg("^[0-9]{1,50}.?[0-9]{0,50}$", $n)) { > return true; > } else {

[PHP] is_numeric

2005-05-04 Thread pete M
not a php expert but have filed this bug report re validating is_numeric('3e0'); http://bugs.php.net/bug.php?id=32943 Now tried function isnumeric($n) { if (ereg("^[0-9]{1,50}.?[0-9]{0,50}$", $n)) { return true; } else { return false; } } and that doent seem to work either.

Re: Re: [PHP] is_numeric questions - followup

2004-07-28 Thread holmes072000
> From: Jeff Oien <[EMAIL PROTECTED]> > > > Does is_numeric include commas decimals and dollar signs? > > > > How do I use this to error check form data? I'm having a hard time > > figuring out what the correct syntax is for that application. Thanks. > > Jeff > > I think what I should have aske

Re: [PHP] is_numeric questions - followup

2004-07-28 Thread Jeff Oien
Jeff Oien wrote: Does is_numeric include commas decimals and dollar signs? How do I use this to error check form data? I'm having a hard time figuring out what the correct syntax is for that application. Thanks. Jeff I think what I should have asked is how to tell if something is not numberic. Je

[PHP] is_numeric questions

2004-07-28 Thread Jeff Oien
Does is_numeric include commas decimals and dollar signs? How do I use this to error check form data? I'm having a hard time figuring out what the correct syntax is for that application. Thanks. Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub

Re: [PHP] is_numeric fails and don't know why

2003-02-07 Thread 1LT John W. Holmes
a" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, February 07, 2003 7:29 AM Subject: [PHP] is_numeric fails and don't know why Hi, I'm trying to read a file that contains a group of numbers, each of them in one line of the file. I need to verify that the file is v

[PHP] is_numeric fails and don't know why

2003-02-07 Thread fmendezpalma
Hi, I'm trying to read a file that contains a group of numbers, each of them in one line of the file. I need to verify that the file is valid, so i read line by line and test if the line is numeric: ... $line = fgets ($FileDesc); $line = trim ($line); if (!is_numeric ($line)) return 0; ...

RE: [PHP] is_numeric for php3

2001-08-28 Thread Steve Edberg
At 03:41 PM 8/28/01 , scott [gts] wrote: >my understanding is that numeric is a broad term for >number values (any value with only numbers and a >decimal point) like 1, 5.6, 332, 0.5532, for example. > >integers are a sub-set of numerics, so any integer is >a numeric value, but any numeric value i

RE: [PHP] is_numeric for php3

2001-08-28 Thread Seb Frost
seb -Original Message- From: Philip Olson [mailto:[EMAIL PROTECTED]] Sent: 28 August 2001 22:44 To: [EMAIL PROTECTED] Subject: [PHP] is_numeric for php3 hi friends, Can someone post here "the" most efficient method to validate a variable as numeric? I see a ton of hacks

Re: [PHP] is_numeric for php3

2001-08-28 Thread Prottoss
e > > list ($x, $y) = split("\.", $number); > > > > // if there's no decimal value > > if ( empty($y) ) { > > return is_int($x); > > } > > else { > > return ( is_int($x) && is_int($y) ); > > } > > >

RE: [PHP] is_numeric for php3

2001-08-28 Thread scott [gts]
ECTED]] > Subject: Re: [PHP] is_numeric for php3 > > Hi Philip, > > By definition, any string that does not contain > alpha-characters is numeric. I mean, '123' is an > integer, if only because it isn't 'onetwothree', you > know? -- PHP Gen

RE: [PHP] is_numeric for php3

2001-08-28 Thread scott [gts]
a few months to fully understand them and get over regexp-heebie-jeebies of my own. > -Original Message- > From: daniel james [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, August 28, 2001 6:42 PM > To: scott [gts]; php > Subject: RE: [PHP] is_numeric for php3 > > &g

RE: [PHP] is_numeric for php3

2001-08-28 Thread daniel james
e > if ( empty($y) ) { > return is_int($x); > } > else { > return ( is_int($x) && is_int($y) ); > } > > } > > > > -Original Message- > > From: daniel james [mailto:[EMAIL PROTECTED]] > > Subject: Re: [PHP] is_numeric

RE: [PHP] is_numeric for php3

2001-08-28 Thread scott [gts]
split("\.", $number); // if there's no decimal value if ( empty($y) ) { return is_int($x); } else { return ( is_int($x) && is_int($y) ); } } > -Original Message- > From: daniel james [mailto:[EMAIL PROTECTED]] > Subject: Re: [PHP

Re: [PHP] is_numeric for php3

2001-08-28 Thread daniel james
Hi Philip, By definition, any string that does not contain alpha-characters is numeric. I mean, '123' is an integer, if only because it isn't 'onetwothree', you know? Because if I do this: $num1 = '123'; $num2 = '456'; $total = $num1 + $num2; print($total); the total is going to be 579. You

Re: [PHP] is_numeric for php3

2001-08-28 Thread Philip Olson
Hi Daniel, No, I mean if it's numeric, not neccesarily an integer. As the following is numeric and not an integer but rather, a string : $num = '123'; Anyone have an authoritative answer on this? Like, something that would go in the manual as the official php3 is_numeric check? Regards,

Re: [PHP] is_numeric for php3

2001-08-28 Thread daniel james
do you mean, as in, if !is_integer($var) { print("$var is not an integer"); } --- Philip Olson <[EMAIL PROTECTED]> wrote: > hi friends, > > Can someone post here "the" most efficient method to > validate a variable > as numeric? I see a ton of hacks/ways in the manual > user comments under > i

[PHP] is_numeric for php3

2001-08-28 Thread Philip Olson
hi friends, Can someone post here "the" most efficient method to validate a variable as numeric? I see a ton of hacks/ways in the manual user comments under is_int, is_integer and is_numeric and would like to see just one or two good solid ones. And please, no regular expressions :) Regards, P