note 29802 added to function.is-int
| From: | martin at rack1 dot php dot net | Date: | Tue, 25 Feb 2003 15:58:17 +0000 |
| Subject: | note 29802 added to function.is-int | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44507@lists.php.net to get a copy of this message | ||
what's wrong with this?
function str_is_int( $str ) {
return ( (string)(int)$str == $str );
}
this seems to allow for "+" and "-" signs, which is nice. You'll have to
test whether $str is null seperately, though.
--
http://www.php.net/manual/en/function.is-int.php
http://master.php.net/manage/user-notes.php?action=edit+29802
http://master.php.net/manage/user-notes.php?action=delete+29802
http://master.php.net/manage/user-notes.php?action=reject+29802