Friday 16 June 2017

comparison - Is there a difference between !== and != in PHP?



Is there a difference between !== and != in PHP?


Answer



The != operator compares value, while the !== operator compares type as well.



That means this:



var_dump(5!="5"); // bool(false)

var_dump(5!=="5"); // bool(true), because "5" and 5 are of different types

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...