note 21234 modified in function.is-int by maxim

From: Date: Thu, 08 Aug 2002 23:17:27 +0000
Subject: note 21234 modified in function.is-int by maxim
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-34583@lists.php.net to get a copy of this message
[Ed. note: is_int() checks whether the type of the variable is an int, not the contents. If you want to check the contents, you can use is_numeric(). ] [Ed. note: There is also a whole set of ctype functions which many of you might find useful: http://www.php.net/manual/en/ref.ctype.php ] is_int() does not work when passing strings. This one does: function str_is_int($str) { $var=intval($str); return ($str==$var); } --was-- [Ed. note: is_int() checks whether the type of the variable is an int, not the contents. If you want to check the contents, you can use is_numeric(). ] is_int() does not work when passing strings. This one does: function str_is_int($str) { $var=intval($str); return ($str==$var); } http://www.php.net/manual/en/function.is-int.php

« previous php.notes (#34583) next »