Comparing Objects
You can use the various comparison operators PHP makes available (== and ===) on objects, but their behavior is worth noting.
-
comparison operator (==) This works on objects by making sure that both objects are of the same type and have the same values for their member data. If either of these is not true, the operator evaluates to FALSE.
-
identity operator (===) This works on objects by indicating if the two objects being compared are the same instance of the class. Otherwise, it evaluates to FALSE.