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 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] 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] Link to comment https://forums.phpfreaks.com/topic/11950-number-validate/#findComment-45374 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.