PHP === and == operators


In PHP syntax the == operator (two equality signs) returns true if the compared values are  equal, even if they are in different types (for example, 7 == “7” is true).

The === operator (three equality signs) returns true only if the compared values are absolutely equal, i.e. they have equivalent types as well (e.g. 7 === “7” returns false but 7 === 7 returns true).

Another example, p == 0 is true for p being 0, but also for p being “0” (a string containing the character 0).

p === 0 is true only when p is 0.

Note that Javascript too provides the === operator.

Report a problem on this page / Make a Request
Get The Power & Follow! don't miss   : :   Sleeper   Favorite Launcher   Savy   Gadgetarian
Fling   Power Copy   Windows Rule   SearchALL Gadget   Amazon Gadget