note 76270 rejected from language.references.whatdo by nicobn
| From: | nicobn@php.net | Date: | Mon, 09 Jul 2007 17:26:34 +0000 |
| Subject: | note 76270 rejected from language.references.whatdo by nicobn | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-128328@lists.php.net to get a copy of this message | ||
Note Submitter: Stephen
----
Note that in the following:
$a =& $b;
while they both will end up referring to the same content, the content of $b from before the
statement is preserved, whereas the content of $a from before the statement is deleted and replaced
with the content of $b. In other words, you might say that $a is "assigned a value equal to a
reference to $b" For example:
$a = 4;
$b = 5;
$a =& $b;
print 'a = ' . $a . '<br>';
print 'b = ' . $b;
prints:
a = 5
b = 5
So yes, they end up becoming the same thing, but it does matter which comes first in the assignment
statement.
This is obvious once you know it, but it's not stated explicitly above for newcomers.