If you want to pass an object but not by reference you can clone
the object beforehand.
<?php
function changeObject($obj) {
$obj->name = 'Mike';
}
$obj = new StdClass;
$obj->name = 'John';
changeObject(clone $obj);
echo $obj->name; // John
changeObject($obj);
echo $obj->name; // Mike
I know objects in php5 are passed by reference by default, but for readability I think I will continue to use the ampersand before the variable name
That's your call but I find that would simply make it read more like C++. Alternativly, you can show that an object is being passed in by using type-hinting in your function definition:
function foo(StdClass $obj)
{
}
Once it's clear that $obj
is an object it can be assumed that it's being passed by reference.