I have a problem baffling me terribly. I noticed this before but didn\'t give it any heed until today.
I was trying to write my own check for integer strings. I know of
Here's a function that more rigorously tests for either an int or an integer string.
function isIntegerNumeric($val) {
return (
is_int($val)
|| (
!is_float($val)
&& is_numeric($val)
&& strpos($val, ".") === false
)
);
}
It's relatively quick and avoids doing any string checking if it doesn't have to.