Perhaps this is just a stylistic question, or perhaps there is a "right" answer.
If I have a php function that needs to return multiple values (and those are incoming args) which is preferred:
function myFuncReturnVals ($a, $b) {
// do stuff
return array ($a, $b)
}
function myFuncByRef (&$a, &$b) {
// do stuff
}
list($a,$b) = myFuncReturnVals ($a,$b);
myFuncByReb($a,$b);
Either way will get the job done, but which is preferred?
ReturnVals seems to be a little cleaner in some respects as it lets the caller decide if their values are going to be modified.
However, sometimes by ref seems to fit better as the intent of the function is really to muck with that data.
What about mixing and matching? What if you have a function that mostly is responsible for giving back some data, but in process might have additional information about the incoming parameter?