juste un peu en dessous dans les note de php.net tu peut lire:
Here is some code that will detect large values for numeric and for PHP3.
function is_num(s) {
v = true;
for i = 0 to strlen(s) {
if (ord(substr(s,i,1)) < 48 || ord(substr(s,i,1)) > 57) v =
false;
}
return v;
}
-----------------------------------------
Someone wanted to know how to check if a val is numeric in PHP3.
Here's my take:
$val = -123.45E293;
$match = '^-?\d+(?:\.\d+)?(?:[Ee]-?\d+)$';
if (preg_match('|' . $match . '|', $val)){
echo $val . ' is a number!';
} else {
echo $val . ' is not a number!';
}
------------------------------------------
In PHP3, how about this?
function is_numeric($n) {
return(0 + $n == $n);
}