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.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to