Objects are passed by reference in PHP. This means that when you assign an object to a new variable, this new variable contains a reference to the same object, not a new copy of the object. This rule applies when assigning variables, passing variables to methods, and passing variables to functions.
In your case, both $obj1 and $obj2 refer to the same object, so changing one of them will change the same object.
source share