isNumber function?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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

Re: isNumber function? wrote:
Quoted text here. Click to load it

Would IsNumeric() fit the bill?

Nicholas Sherlock

Re: isNumber function?

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

Site Timeline