note 10425 added to Returning References
| From: | sam at liddicott dot com | Date: | Wed, 03 Jan 2001 06:24:28 +0000 |
| Subject: | note 10425 added to Returning References | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-9305@lists.php.net to get a copy of this message | ||
You might want to try
function &foo() {
$tmp=array(blah);
return &$tmp; '' or return %tmp;
}
$var=&foo();
I think trying to return an anonymous array (as you were) by reference won't work, also trying
to assign a reference to any array to elements of list won't work.
If you want to return an array of references you should make one, but how to assign an aarray of
references by reference to a list() structure I don't know.
My advice is to forget references in this case, and return by copy a list which contains either
references to scalars or actual objects or hashes. Then the list can be copied upon return but will
still refer to the real values.
http://www.php.net/manual/language.references.return.php