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 {

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

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

2003-02-07 Thread 1LT John W. Holmes
Well, since is_numeric('.101972E+00') works on it's own, there must be something else coming with it from the file that makes it fail. Try to trim() each number before you test it. Maybe that'll help. ---John Holmes... - Original Message - From: "fmendezpalma" <[EMAIL PROTECTED]> To: <[EM

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
if (($var!=0) && ($var*1!=0) && is_int($var*1)) { echo "is int"; $var=$var*1; } else { echo "is not int"; $var=1; } Works for me because I need an integer greater than 0. Try it out and let me know any problems with it. - seb -Original Message- From: Phi

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