Points
How are two objects compared in PHP?
PHP provides you with the ‘==’ operator, which is used to compare two objects at a time. This is used to check if there is a common presence of attributes and values between the objects in comparison.
The ‘===’ operator is also used to compare if both objects in consideration are referencing to the same class.
$ob2= (object)['t'=>'m'];
$ob1= (object)['t'=>'m'];
echo ($ob1 == $ob2);
Result: 1
---------------------------------------------------
Comments
Post a Comment