Re: Re: strange stripos behavior
| From: | Shawn McKenzie | Date: | Wed, 25 Jul 2007 02:55:47 +0000 |
| Subject: | Re: Re: strange stripos behavior | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-259466@lists.php.net to get a copy of this message | ||
Yes, I understand that, but it said that "this function" may return 0 or
"". So I guess that is just a generic statement to illustrate the point.
-Shawn
Robert Cummings wrote:
> On Tue, 2007-07-24 at 20:03 -0500, Shawn McKenzie wrote:
>> For another guru, I have a question. I just checked the returns of this
>> func on php.net to check myself and I see:
>>
>> This function may return Boolean FALSE, but may also return a
>> non-Boolean value which evaluates to FALSE, such as 0 or "".
>>
>> When would stripos() return "" ?
>
> It wouldn't. What it means is that if you use == to test the return
> value then you won't know if the string failed to match or if it matched
> at index 0. Instead you should use === false to check for failure.
>
> Cheers,
> Rob.