#26484 [Opn->Bgs]: "Returning References" could do with more info
| From: | vrana@php.net | Date: | Fri, 06 Aug 2004 21:32:40 +0000 |
| Subject: | #26484 [Opn->Bgs]: "Returning References" could do with more info | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969362787@lists.php.net to get a copy of this message | ||
ID: 26484
Updated by: vrana@php.net
Reported By: sdavey at datalink dot net dot au
-Status: Open
+Status: Bogus
Bug Type: Documentation problem
Operating System: NA
PHP Version: 4.3.2
New Comment:
It's illegal to omit one or the other & thus there is "you have to use
& in both places". In current PHP versions (4.3.8, 5.0.0) it seems that
& in function declaration is informative only but it can change in the
future.
Previous Comments:
------------------------------------------------------------------------
[2003-12-01 06:22:50] sdavey at datalink dot net dot au
Description:
------------
The Returning References manual page contains the following comment:
"Note: Unlike parameter passing, here you have to use & in both places
- to indicate that you return by-reference, not a copy as usual, and to
indicate that reference binding, rather than usual assignment, should
be done for $foo."
It refers to pass-by-reference, where you have to use the ampersand in
both the function *and* in the assignment of the function value to a
variable.
It is not clear what would happen if you didn't put the ampersand in
both places, and it would be nice to have someone explain this.
I'm a fairly seasoned PHP developer, but references are complex, and
judging by the user comments in various places in the manual concerning
them I think it would be great to have a sentance or two clarify this.
I know it's only a minor request, but for developers seeking to
fine-tune their code, understanding references is clearly the way to
go.
Thanks, Scott.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26484&edit=1