All of my functions that have multiple parameters and that need to return more than one of those values I return an array
like so...
function eg($a, $b) {
$a += 5;
$b += 10;
return array('a' => $a, 'b' => $b);
}
$no = eg(0, 5);
echo $no['a']; // 5
echo $no['b']; // 10
Is this considered bad practice compared to passing by reference ie;
function eg(&$a, &$b) {
$a += 5;
$b += 10;
}
eg(0, 5);
echo $a; // 5
echo $b; // 10
Does this really matter? When would I want to use one over the other when using the examples above? Is there any difference in performance?
Thanks