Re: Re: strange stripos behavior
| From: | Robert Cummings | Date: | Wed, 25 Jul 2007 01:30:40 +0000 |
| Subject: | Re: Re: strange stripos behavior | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-259462@lists.php.net to get a copy of this message | ||
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.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................