note 18958 added to language.references.whatdo
| From: | todd at nemi dot net | Date: | Mon, 11 Feb 2002 16:15:31 +0000 |
| Subject: | note 18958 added to language.references.whatdo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-26478@lists.php.net to get a copy of this message | ||
tbutzon@imawebdesigner.com Makes an excellent point in his reference examples, however, what you
find in practice is that you do not need the & in the function definition to actually assign the
reference. It is redundant.
The proper way to return a reference is by using:
function &myClass() {
//...some code...
return $this;
}
$myObj =& new myClass()
...however, this produces the exact same result:
function myClass() {
//...some code...
return $this;
}
$myObj =& new myClass()
Apparently, the Ampersand on the assignment is all that is really needed for a reference to truly be
assigned. The Ampersand on the function definition actually does nothing.
--
http://www.php.net/manual/en/language.references.whatdo.php
http://master.php.net/manage/user-notes.php?action=edit+18958
http://master.php.net/manage/user-notes.php?action=delete+18958
http://master.php.net/manage/user-notes.php?action=reject+18958