## General developer forum

### =& - Simple question

Re: =& - Simple question
Joseph, I've not looked up the functions you've mentioned above to see them in context. However, as a general rule, they may still be valid, if the parameters are not objects.

If you want to pass an array into a function and have it filled in, or you want to pass in a variable to be filled with a string or integer, then passing by reference is valid (in the function definition, but not at call time). If you are passing an object in to a function, or taking a reference to an object to update it (eg inside a form definition), you should not include the & symbol as PHP5 already passes objects as references.

Average of ratings: Useful (1)
Re: =& - Simple question

As Davo says, most, but not all, &s should go, but it is not critcial.

I just wanted to point out that instead of a function like

function return_two_things_nasty($input, &$otherreturnvalue) {
$otherreturnvalue = 'two ' .$input;
return 'one ' . $input; }$otherreturnvalue = '';
$firstreturnvalue = return_two_things_nasty('sheep',$otherreturnvalue);

function return_two_things_nice($input) { return array('one ' .$input, 'two ' . $input); } list($firstreturnvalue, \$otherreturnvalue) = return_two_things_nice('sheep');