Re: Re: is_int/is_numeric possible bug
| From: | Bastian Grupe | Date: | Tue, 29 Nov 2005 17:59:25 +0000 |
| Subject: | Re: Re: is_int/is_numeric possible bug | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-20857@lists.php.net to get a copy of this message | ||
Ben Litton wrote:
You could always do an is_numeric and if it returns true, cast it as an int.That is the way it's meant to be done. is_int() really checks for the dataTYPE and not the CONTENTS (of course the contents depend on the type, e.g. in an int you won't find a string). giving is_numeric() and the ctype functions strings as argument actually check for the CONTENTS (in different ways). is_int(1) => true is_int("1") => false is_numeric(1) => true is_numeric("1") => true I hope now everything is clear for everybody. Regards, B. Grupe P.S.: I think the general/help lists are more appropriate for these kind of problems before asking internals. P.P.S.: Sorry for potential spam, but I thought it is necessary to clear it up once and for all.