Php Shallow Object Copy vs Deep Object Copy when Cloning
When we clone an object, that contains other objects is important to keep in mind that the objects stored in the properties of the object being cloned will stay as references to the original object, by other words will not be cloned, thus any change in this objects will have a direct reflex on the original object. This type of Clone is called a Shallow Object Copy. So we can control what happens when an object is cloned by implementing the method __clone() and inside of it we will ensure that all properties containing another object will contain also a clone of that object.