Jump to content

Help me understand this operator


brentmoeller

Recommended Posts

$a === $b

if $a is equal to $b, and of the same type

 

when would you ever need to use this operator? I mean if its not  == then its going to be false so why even test if its the same type.

and if it is == then in theory it has to be the same type so why test it? Am i completely over looking something?

Link to comment
https://forums.phpfreaks.com/topic/230043-help-me-understand-this-operator/
Share on other sites

Hi Brent,

 

The difference is that

 

 

== will return TRUE whether the two operands have the same value or not.

 

=== evaluates to TRUE if the two operands have the same value and are the same type.

 

 

99% of the time I just use == . I've never used ===

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.