RE: [PHP] odd behavior of stripos() with === operator *LAST POST*

From: Date: Fri, 17 Nov 2006 17:12:27 +0000
Subject: RE: [PHP] odd behavior of stripos() with === operator *LAST POST*
Groups: php.general 
Request: Send a blank email to php-general+get-244818@lists.php.net to get a copy of this message
On 17 November 2006 16:50, Stut wrote: > > > Your basic misunderstanding is that === is the opposite of !== > > > which it's not. Complete rubbish -- it so absolutely is! If $a===$b, then !($a===$b) is the same as $a!==$b, QED. > > > (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 Well, you haven't covered all bases there, you've got INTEGER===true in twice! Try this: (integer)===TRUE -- is always FALSE (integer)!==TRUE -- is always TRUE (integer)===FALSE -- is always FALSE (integer)!==FALSE -- is always TRUE Looks seriously like two sets of complementary results there to me. > > > The actual value of the INTEGER does not matter. True. > > > But the basic thing to get clear in your head is that === and !== > > > are not opposites in the same way that == and != are. False, false, false, and a thousand times false. If $a===$b returns TRUE, then $a!==$b returns FALSE; and if $a===$b returns FALSE, then $a!==$b returns TRUE. I don't know how much more opposite you can get. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: m.ford@leedsmet.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

« previous php.general (#244818) next »