note 110260 deleted from language.references.return by danbrown

From: Date: Wed, 17 Oct 2012 21:28:26 +0000
Subject: note 110260 deleted from language.references.return by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-191408@lists.php.net to get a copy of this message
Note Submitter: slepic ---- @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.

« previous php.notes (#191408) next »