note 56573 deleted from function.is-numeric by nlopess
| From: | nlopess@php.net | Date: | Thu, 27 Jul 2006 12:19:23 +0000 |
| Subject: | note 56573 deleted from function.is-numeric by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-115251@lists.php.net to get a copy of this message | ||
Note Submitter:
----
Below was a buggy function is_num, here is the fix:
function is_num($var) {
for ($i=0;$i<strlen($var);$i++) {
$ascii_code=ord($var[$i]);
if (intval($ascii_code) >=49 && intval($ascii_code) <=57) {
continue;
} else {
return false;
}
}
return true;
}