Questions About 9000000000000000

Convert any string number into integer type in PHP considering toInt returns 0 for fail instead of false

How do I write a function that returns FALSE if a given string is NOT A VALID NUMBER OF TYPE [PHP INT], and returns TRUE otherwise.

This is simple in other languages.

intval(), isint(), and is_numeric() are not adequate, here is why:

is_numeric() is not adequate because it matches to any number not just integers, also it accepts huge numbers as numeric, which aren't integers. intval() is not adequate because it returns 0 for BOTH invalid PHP integers like '9000000000000000' AND the valid PHP integer '0' or '0x0' or '0000' etc. isint() only tests if a variable is already of type int, it doesn't deal with strings or conversion to int.

Maybe there is a popular library for this or something?

I want to call a function that is capable of detecting whether the form data someone posts is a valid php integer, for instance.

I want to call the function that does this: is_php_integer($str_test_input). What goes in the function?

&l
    
http://www.stackoverflow.com/questions/14448244/convert-any-string-number-into-integer-type-in-php-considering-toint-returns-0-for-fail-instead-of-fal