FilChi Weblog

the opposite of ‘===’

Posted on: February 13, 2008

I just went to the ##php channel in to ask the great gurus about the opposite of ‘===’ .
Here is the excerpt of our discussion:

 <phpcurious> hi, just a quick question… how do you check two variables if they are not having the same value , BUT the same type ? is it like ‘!===’ ???
<Assid> === is it abitwise check
<Yancho> === like this should be enough i guess no ?
<phpcurious> well, just curious if there is such operator ?
<Assid> if you want to reverse the logic.. you use !
<Dynom> phpcurious; getttype()
<shsek> === is the same type and same value
<Assid> yes.. === checks the type as well as value
<Dynom> Assid; he only wants to check the type
<shsek> you should compare gettype
<Assid> oh gettype then
<shsek> if (gettype($bar) == gettype($foo))
<phpcurious> no, not really sorry to confuse you guys
<phpcurious> i was just curious if I can use ‘ !=== ‘ to reverse the logic of ‘===’
<Assid> yes
<Dynom> no, use !==
<Assid> Dynom: == and === arent the same thing
<Dynom> == => !=, === => !==
* Dynom looks at Assid
* Assid poses
<phpcurious> wooah Dynom : == => !=, === => !== <— what do you mean by that ?
<Jopie> I’m using several functions and sharing variables between the variables are driving me nuts cause I’m loading / including classes in the function and each time I have to use global to be able to use the loaded class in another function… is there a better way?
<shsek> phpcurious, != is the opposite of ==
<shsek> phpcurious, !== is the opposite of ===
<Dynom> phpcurious; I’m saying that you stay at the same amount of characters. so === doesn’t become 4 characters like this: !=== but it remains 3 characters and becoming: !==
<Dynom> and not like Assid says, just stick a nor at the start, where == becomes !== and === becomes !===
<shsek> just like == becomes != and not !==, === becomes !== and not !===
<Assid> my bad
<Dynom> phpcurious; the amount of character remain the same, thats important to remember. Understand it now ?
<Assid> yeah Dynom’s right
<phpcurious> yes Dynom thank you very much .
<Assid> !== is the opp. of ===
<Dynom> phpcurious; glad to help
<phpcurious> yeah… thanks again

Flickr Photos

%d bloggers like this: