Why does is_int always return false in the following situation?
is_int
echo $_GET[\'id\']; //3 if(is_int($_GET[\'id\'])) echo \'int\'; //not execut
The dirty solution I'm using is this:
$val = trim($_GET['id']); $cnd = ($val == (int)$val); echo $cnd ? "It's an int" : "Not an int";
Apart from the obvious (ugly code that hides its workings behind specifics of the php engine), does anybody know cases where this goes wrong?