note 110260 added to language.references.return
| From: | slepic | Date: | Fri, 05 Oct 2012 14:50:01 +0000 |
| Subject: | note 110260 added to language.references.return | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-191149@lists.php.net to get a copy of this message | ||
@spidgorny at gmail dot com 18-Mar-2010 11:18
"...and the reference becomes a normal variable."
Actually that's not true. What really happens is that the object is destructed upon return,
because there are no more references to that object. But the 'data' property remains
referenced by the variable to which you assign the return value. So that variable becomes the only
object referencing that property. So in fact the instance of MemcacheArray is destructed, but
it's 'data' property is not. Therefore it may look like it became "a normal
variable", but it actualy is a reference to something noone else references.
In other words, it references what used to be part of a bigger object, but as only the
'data' property remains referenced by someone, the rest of the object was dropped and the
'data' property remains referenced by only one variable which means there are no
dependencies on other variables possibly referencing it.
----
Server IP: 69.147.83.199
Probable Submitter: 62.84.131.138
----
Manual Page -- http://www.php.net/manual/en/language.references.return.php
Edit -- https://master.php.net/note/edit/110260
Del: integrated -- https://master.php.net/note/delete/110260/integrated
Del: useless -- https://master.php.net/note/delete/110260/useless
Del: bad code -- https://master.php.net/note/delete/110260/bad+code
Del: spam -- https://master.php.net/note/delete/110260/spam
Del: non-english -- https://master.php.net/note/delete/110260/non-english
Del: in docs -- https://master.php.net/note/delete/110260/in+docs
Del: other reasons-- https://master.php.net/note/delete/110260
Reject -- https://master.php.net/note/reject/110260
Search -- https://master.php.net/manage/user-notes.php