This behavior is explained here when you do the following:
$obj = new Student(); $obj1 = $obj;
$obj1 is actually a reference to $obj , so any changes will be reflected in the original object. If you need a new object, then declare it with the new keyword again (as it is for it) as such:
$obj = new Student(); $obj1 = new Student();
(Also, I see that @Wizard sent about the same thing halfway through me by writing this, but I will leave it here for examples)
source share