note 18168 modified in function.intval by philip
| From: | philip@php.net | Date: | Wed, 26 Mar 2003 00:49:01 +0000 |
| Subject: | note 18168 modified in function.intval by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-45820@lists.php.net to get a copy of this message | ||
[Editors note: Or simply use is_numeric() or ctype_digit() as forms pass stringed numbers, not
integers]
If you wish to is_int() so called values from a form or in general this would mean numbers in
strings, you can just do the following
[code]
$nr = "203";
if(is_int($nr+0))
echo "is integer";
else
echo "is not integer";
[/code]
The $nr+0 will convert the string to a real numerical value in order to add 0 to it.
--was--
If you wish to is_int() so called values from a form or in general this would mean numbers in
strings, you can just do the following
[code]
$nr = "203";
if(is_int($nr+0))
echo "is integer";
else
echo "is not integer";
[/code]
The $nr+0 will convert the string to a real numerical value in order to add 0 to it.
http://www.php.net/manual/en/function.intval.php