note 39588 deleted from language.references by cmb
| From: | cmb@php.net | Date: | Sun, 01 Sep 2019 07:48:45 +0000 |
| Subject: | note 39588 deleted from language.references by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212068@lists.php.net to get a copy of this message | ||
Note Submitter: developer at sirspot dot com
----
Since references are more like hardlinks than pointers, it is not possible to change a reference to
an object by using that same reference. For example:
The following WILL NOT WORK as expected and may even crash the PHP interpreter:
$object =& $object->getNext();
However, by changing the previous statement to use a temporary reference, this WILL WORK:
$temp =& $object;
$object =& $temp->getNext();