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