note 40424 deleted from function.is-int by nlopess
| From: | nlopess@php.net | Date: | Wed, 03 Mar 2004 17:40:30 +0000 |
| Subject: | note 40424 deleted from function.is-int by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-66187@lists.php.net to get a copy of this message | ||
Note Submitter: ilja_m@gmx.de
----
I've noticed, that is_int() will NOT recognise integers set as strings:
$var = "10";
OR
$var = $_POST['someint'];
is_int($var) returns allways "false"!
to check, if a string-argument is an integer, you have to evaluate it to a new var. without
"" (brackets)
@eval("\$try_int = $var;");
then check if $try_int is an integer...
is_int($try_int) -> will return "TRUE" (if $var was realy an int)!
NOTE: eval() will couse an php-warning/error, if the $var is NOT an integer -> therefore an
"@"