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

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


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

!= is the inverse of the == operator, which checks equality across types

!== is the inverse of the === operator, which checks equality only for things of the same type.