Nasrul Hazim Bin Mohamad

PHP – Comparison(==) VS Identity(===) Operator

Jan
26

$isequal = ($obj1 == $obj2);

Comparison Operator(==), checks whether the two objects are the same class and whether all class variables have the same value.

$issameinstace = ($obj1 === $obj2);

Identity Operator(===), return true if both object variables refer to the same instance of an object.

Leave a Reply

Your email address will not be published. Required fields are marked *

one × two =