Note that this function is not appropriate to check if "is_numeric" for very long strings. In fact, everything passed to this function is converted to long and then to a double. Anything greater than approximately 1.8e308 is too large for a double, so it becomes infinity, i.e. FALSE. What that means is that, for each string with more than 308 characters, is_numeric() will return FALSE, even if all chars are digits.
However, this behaviour is platform-specific.
http://www.php.net/manual/en/language.types.float.php
In such a case, it is suitable to use regular expressions:
function is_numeric_big($s=0) {
return preg_match('/^-?\d+$/', $s);
}