Re: [PHP4BETA] return references branch merged into the main repository
| From: | Andrei Zmievski | Date: | Wed, 15 Dec 1999 21:53:05 +0000 |
| Subject: | Re: [PHP4BETA] return references branch merged into the main repository | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-7976@lists.php.net to get a copy of this message | ||
On Wed, 15 Dec 1999, Zeev Suraski wrote:
> Andi and I finished working on the return references support in Zend. We
> tested it a bit, and merged it into the main branch.
>
> To return a reference from a function, you must tag the function as a
> function that returns a reference:
>
> function &foo($a, $b, $c)
> {
> ...
> }
>
> However, $a = foo(...) will still not cause $a to be a reference to the
> returned value (much like $a = $b, when $b is a reference, copies the value
> of $b onto $a, and doesn't make $a to be a reference to $b). In order to
> make $a be a reference to the returned value, you must use the notation:
>
> $a = &foo();
Can this be changed? This way you have to do double work of declaring
function to return reference and remembering to use & when calling it.
On the other hand, I guess it gives you flexibility of choosing whether
the return value is really a reference. :)
-Andrei
Any sufficiently advanced Operating System
is indistinguishable from Linux.
- Jim Dennis