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