Use a reference to avoid creating copies. This becomes very important when passing an object to a process which modifies it.
Try the following code with and without the & in the function header.
function setSomething(&$obj)
{
$obj->something = 'xxx';
}
$obj = new stdClass;
$obj->something = 'aaa';
setSomething($obj);
echo 'Something ' . $obj->something . "\n";