if I pass an object to a function in PHP, it's passed by reference, and if I set that object to a new object, it doesn't 'stick'. How can I assign a new object to an object that's passed in preferably without iterating over all properties?
e.g.:
function Foo($obj)
{
// do stuff and create new obj
$obj = $newObj;
// upon function exit, the original $obj value is as it was
}