note 14971 modified in function.is-int.php by jeroen
| From: | jeroen@php.net | Date: | Wed, 22 Aug 2001 23:00:11 +0000 |
| Subject: | note 14971 modified in function.is-int.php by jeroen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-17005@lists.php.net to get a copy of this message | ||
[Editor's note: this simply ALWAYS will be true, so is of no use. PHP will convert your var to
a number, even if it is, let's say, "abc"
--jeroen]
This seems to work just fine for HTTP variables (params passed by GET/POST, which are always
strings):
if( is_int( $id * 1 ) )
echo "Valid";
else
echo "Invalid;";
-Nick (http://www.nickbouton.com/)
http://www.php.net/manual/en/function.is-int.php.php