note 26509 deleted from function.is-int by didou
| From: | didou@php.net | Date: | Sun, 18 May 2003 10:16:16 +0000 |
| Subject: | note 26509 deleted from function.is-int by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-48500@lists.php.net to get a copy of this message | ||
Note Submitter: criess at yahoo inc dot com
----
The above examples fail when $str = "3.0" because PHP's equality operator evaluates
it in a numeric context.
How about this function:
function str_is_int($str) {
return strcmp($str , (int)$str);
}
Of course the above fails for $str = "+5" or $str = "-0" but oh well.