isNumber function?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • laredotornado@zipmail.com

    isNumber function?

    Hello, I'm using PHP 4 and I was wondering if there was a function, or
    an easy way to check if a variable is a number. THe "intval" function
    doesn't work very well for me because if the variable is "abc" or "0",
    the same value is returned. I would prefer a function that tells me
    "abc" is not a number and "0" is a number.

    Thanks, - Dave

  • Nicholas Sherlock

    #2
    Re: isNumber function?

    laredotornado@z ipmail.com wrote:[color=blue]
    > Hello, I'm using PHP 4 and I was wondering if there was a function, or
    > an easy way to check if a variable is a number. THe "intval" function
    > doesn't work very well for me because if the variable is "abc" or "0",
    > the same value is returned. I would prefer a function that tells me
    > "abc" is not a number and "0" is a number.[/color]

    Would IsNumeric() fit the bill?

    Cheers,
    Nicholas Sherlock

    Comment

    • Philip  Olson

      #3
      Re: isNumber function?

      Just in case you didn't find it yet... it's is_numeric() ;-)

      Comment

      Working...