Re: Re: strange stripos behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux