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~! Link to comment https://forums.phpfreaks.com/topic/64342-php-nan/ 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 Link to comment https://forums.phpfreaks.com/topic/64342-php-nan/#findComment-320812 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 Link to comment https://forums.phpfreaks.com/topic/64342-php-nan/#findComment-320852 Share on other sites More sharing options...
corbin Posted August 11, 2007 Share Posted August 11, 2007 Whoa.... Never knew about that.... hehe ;p Link to comment https://forums.phpfreaks.com/topic/64342-php-nan/#findComment-320864 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.