Re: odd behavior of stripos() with === operator *LAST POST*
| From: | Stut | Date: | Fri, 17 Nov 2006 16:49:55 +0000 |
| Subject: | Re: odd behavior of stripos() with === operator *LAST POST* | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-244816@lists.php.net to get a copy of this message | ||
Ok, just to shut you all up, I managed to convince the OP earlier today, but it never made it to the list...
Michael wrote:
At 02:58 AM 11/17/2006 , Stut wrote:OK I lied, that wasn't my last post , sorry. *lightbulb* Stut, thanks for your help, my thinking that !== and === are opposites is exactly the problem :) I WAS thinking of them as being like != and ==. the stick worked I think :) I finally get it. Thanks again. Cheers, Michael -StutMichael wrote:Ok, off-list because it will start to annoy people. Your basic misunderstanding is that === is the opposite of !== which it's not. As I've said in previous emails... (INTEGER === true) will always be false because the types don't match (INTEGER !== true) will always be true because the types don't match (INTEGER === false) will always be false because the types don't match (INTEGER === true) will always be false because the types don't match The actual value of the INTEGER does not matter. But the basic thing to get clear in your head is that === and !== are not opposites in the same way that == and != are. Does that make it clearer? -StutThanks to all who replied, I have it figured out. I guess my only problem with the way the !== and === operators work in this situation is this: Logic dictates that if something evaluates to NOT FALSE it must be TRUE. Regardless of the type, regardless of the species, breed, flavor etc. if !== evaluates to TRUE then === should also under the same conditions (all other things being equal) if !== evaluates an integer 0 to TRUE, so should ===, it can't be true and still return a false value. The !== and === operators work differently, they should be complimentary. Sorry if all this has inconvenienced anyone.This will be my last post on this thread of discussion.