Since PHP 5 no longer passes around the actual contents of an object between
functions (only a reference), how do you copy an object?
Answer: You 'clone" it using the __clone() built-in class method
<?php
class anotherclass {
var $id;
}
/* Start an instance */
$a = new anotherclass();
$a->id = 10;
/* Clone the active instance, making a copy of the entire object */
$b = $a->__clone();
$b->id = 20;
?>