By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,776 Members | 1,246 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,776 IT Pros & Developers. It's quick & easy.

isNumber function?

P: n/a
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

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
la***********@zipmail.com wrote:
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.


Would IsNumeric() fit the bill?

Cheers,
Nicholas Sherlock
Jul 17 '05 #2

P: n/a
Just in case you didn't find it yet... it's is_numeric() ;-)

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.