[PHP] Re: Odd is_int() behaviour

2001-10-22 Thread Yasuo Ohgaki


Yasuo Ohgaki wrote:

> This is expected behaviour.
> 
> Ashley M. Kirchner wrote:
> 
>> I have the following snippet in my file:
>>
>>   if ($PATH_INFO == "") { $PATH_INFO = "/"; }
>>   echo "PATH_INFO: $PATH_INFO\n";
>>   // All we want is the fist element, call it $section
>>   list($section) = explode('/', substr($PATH_INFO,1));
> 
> 
> 
> explode() is string function and returns array of strings. Therefore, 
> type is integer.


Oops. Obviously this line is wrong. It should be

"There for type is STRING" not integer...

--
Yasuo Ohgaki


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Odd is_int() behaviour

2001-10-21 Thread Yasuo Ohgaki

This is expected behaviour.

Ashley M. Kirchner wrote:

> I have the following snippet in my file:
> 
>   if ($PATH_INFO == "") { $PATH_INFO = "/"; }
>   echo "PATH_INFO: $PATH_INFO\n";
>   // All we want is the fist element, call it $section
>   list($section) = explode('/', substr($PATH_INFO,1));


explode() is string function and returns array of strings. 
Therefore, type is integer.

>   if (is_int($section)) {
> echo "section: $section\n";
>   } else {
> echo "Invalid section (NON_INT: $section)\n";
>   }
> 
> Um, why does it fail when I hit the script with any INT?


'1' is not integer, but string.
1 is integer.

BTW, all user inputs(POST/GET/etc) are string.

--
Yasuo Ohgaki


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]