php get copy of any object code example
Example 1: php clone
//Copies an existing object
$objectA = clone $objectB;
Example 2: php clone object
$objectB = clone $objectA;
//Copies an existing object
$objectA = clone $objectB;
$objectB = clone $objectA;