php_novice2007 Posted August 10, 2007 Share Posted August 10, 2007 Hi, Is there an equivalent in PHP for the javascript function isNaN()? (checks if something is a legal number or not) Also, is it possible to return NaN in php? Thanks~! Quote Link to comment Share on other sites More sharing options...
corbin Posted August 10, 2007 Share Posted August 10, 2007 is_numeric if(is_numeric($var)) { echo 'it's a number!'; } http://php.net/is_numeric Quote Link to comment Share on other sites More sharing options...
Guest Posted August 11, 2007 Share Posted August 11, 2007 Or alternatively, there's an is_nan() function: if( is_nan($var) ) { echo "whoop de doo!"; } http://www.php.net/is_nan Quote Link to comment Share on other sites More sharing options...
corbin Posted August 11, 2007 Share Posted August 11, 2007 Whoa.... Never knew about that.... hehe ;p Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.