note 14786 added to ref.ctype.php
| From: | rhornsby at ag dot ohio-state dot edu | Date: | Tue, 14 Aug 2001 22:22:53 +0000 |
| Subject: | note 14786 added to ref.ctype.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-16722@lists.php.net to get a copy of this message | ||
Its not a perfect solution, but if you're can't or don't want to use the ctype
functions, you can test to see if something is an integer by doing something like this:<br>
<br>
if ( $var != "0" && $var / 1 == 0 ) { }<br>
<br>
it seems redundant, but you're checking to be sure that $var is not the string representation
of 0 first, and then finding out if $var is divisible by itself.
http://www.php.net/manual/en/ref.ctype.php