Re: gettype() returning string instead of integer
| From: | Brian Curtis | Date: | Wed, 13 Dec 2000 22:22:34 +0000 |
| Subject: | Re: gettype() returning string instead of integer | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-30185@lists.php.net to get a copy of this message | ||
> > In the following situation, I'm finding that PHP4 (CGI) is returning
> > "string" instead of "integer":
> >
> > $myType = gettype($myVar);
> > echo "type is: $myType";
> >
> > and calling the above code via:
> >
> > <A HREF="http://dom.ext/type.php?myVar=1">
> >
> > results in "type is: string" no matter what's used in the URL.
> >
> > Should gettype() not return "integer" in the above situation? Am I
missing
> > something? The docs didn't mention any gotcha's or notes.
> >
>
> There is one really big gotcha: HTTP doesn't allow differentiation between
> integers and strings in GET and POST, so everything is a string.
I was afraid that would be the answer.
OK then, on to my next question. Anyone have a quick,
off-the-top-of-their-head solution to check that a value passed using GET
is_type() "x"?
Thanks again,
--
Brian Curtis