note 57314 deleted from function.is-numeric by mazzanet

From: Date: Fri, 30 Sep 2005 10:35:16 +0000
Subject: note 57314 deleted from function.is-numeric by mazzanet
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-96039@lists.php.net to get a copy of this message
Note Submitter: php at barryhunter [.] co [.] uk ---- An even better version of the function in that it copes with 0's, as well as , and . for thousends seperators and decimal points function is_num($var) { for ($i=0;$i<strlen($var);$i++) { $ascii_code=intval(ord($var{$i})); if (($ascii_code >=48 && $ascii_code <=57) || $ascii_code ==46 || $ascii_code ==44) { continue; } else { return false; } } return true; }

« previous php.notes (#96039) next »