At 02:33 AM 11/17/2006 , Stut wrote:
>Michael wrote:
>> I understand that the integer 0 and FALSE are different and I read the 
>> manual so many times my head hurts, heh.
>>
>> There are a few ways to work around this, probably more than I know. 
>> (according to the documentation for strrpos() you could test the return from 
>> stripos() for is_bool before using it), or (perhaps, cast the return from 
>> stripos() to a boolean, although integer 0 probably casts to false :/, I 
>> honestly didn't test this {see >>>}), or (easiest solution...just suck up 
>> and use !== FALSE all the time :D )
>>   
>
>I'm not understanding what you need to work around. What's wrong with 
>using !== false?

Nothing at all wrong with using "!== FALSE" :) I am doing so NOW :)
However, I DIDN'T know that (integer) 0 !== FALSE and (integer) 0 === TRUE are 
not the same thing, perhaps someone else will gain from my experience here.

>
>> My point in posting this was threefold,
>> 1) to help others who may not know that stripos() returns an INTEGER 0 when 
>> the needle is found at the beginning of haystack, and/or don't realize the 
>> implications of that.
>>   
>
>The manual page for strpos and any other function that may return 0 or 
>false clearly make this point.
>
>> 2) My main point is that !== works, so should ===. If !== knows the 
>> difference between integer 0 and boolean FALSE, why doesn't ===?
>>   
>
>It does, but it also knows the difference between 1 and true, 2 and 
>true, 3 and true, etc.
>
>> 3) to get feedback from the community and deepen my understanding of PHP.
>
>I'm trying ;)

I appreciate your efforts :) Thanks again!

>
>-Stut
> 

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

Reply via email to