note 27632 added to function.is-int
| From: | phpnet dot zu dot askwar at spamgourmet dot com | Date: | Fri, 13 Dec 2002 15:50:13 +0000 |
| Subject: | note 27632 added to function.is-int | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-40865@lists.php.net to get a copy of this message | ||
The last example also didn't quite work as I expected, because strcmp() returns 0 if the
strings are equal. However, 0 == false.
Now, here's my take:
function str_is_int($str) {
return 0 === strcmp($str , (int)$str);
}
This will return a bool.
--
http://www.php.net/manual/en/function.is-int.php
http://master.php.net/manage/user-notes.php?action=edit+27632
http://master.php.net/manage/user-notes.php?action=delete+27632
http://master.php.net/manage/user-notes.php?action=reject+27632