ZoorBIS Posted June 14, 2006 Share Posted June 14, 2006 Hi all,Am having trouble trying to find a php function to check a number.Have tried is_integer and is_intWhat is the best way of checking / validating number.The numbers can be anything like11.223.33334 Quote Link to comment https://forums.phpfreaks.com/topic/11950-number-validate/ Share on other sites More sharing options...
poirot Posted June 14, 2006 Share Posted June 14, 2006 You also can try is_numeric:[a href=\"http://www.php.net/is_numeric\" target=\"_blank\"]http://www.php.net/is_numeric[/a]Or you can simply skip that and use typecasting[a href=\"http://www.php.net/manual/en/language.types.type-juggling.php\" target=\"_blank\"]http://www.php.net/manual/en/language.type...pe-juggling.php[/a][a href=\"http://www.php.net/settype\" target=\"_blank\"]http://www.php.net/settype[/a] Quote Link to comment https://forums.phpfreaks.com/topic/11950-number-validate/#findComment-45373 Share on other sites More sharing options...
AndyB Posted June 14, 2006 Share Posted June 14, 2006 [code]if ($whatever + 0 != 0) {// $whatever must be a number}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/11950-number-validate/#findComment-45374 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.