In the previous PHP object-oriented object and reference, we tried to copy the object in the way of "$b=$a" to pass the value (content) of the object, but the result was to pass the address of the object. At the end, in order to solve The question of copying objects mentioned the cloning method. Next, let’s talk about php object-oriented cloneobject.
We have known before that when calling an object using a pass-by reference, the actual call is the same object. Sometimes it is necessary to create a copy of the object. When changing the original object, we do not want to affect the copy. In PHP You can clone an identical object based on the current object. The cloned copy is completely independent of the original two objects and does not interfere with each other.
Object Clone
Use "clone" keyword in php to clone objects.
<?php class Person { public $name; function