note 52835 added to language.references.whatdo
| From: | somebody at somwhere dot com | Date: | Sat, 14 May 2005 04:26:47 +0000 |
| Subject: | note 52835 added to language.references.whatdo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-89405@lists.php.net to get a copy of this message | ||
More References Fun!
<?php
$a = 'This is a string';
$b = &$a;
$c = &$b;
$d = $b;
echo 'c = '. $c .'<br />';
echo 'd = '. $d .'<br />';
$a = 'Changed a String';
echo '<br />';
echo 'c = '. $c .'<br />';
echo 'd = '. $d .'<br />';
unset($b);
$b = 'Some other string';
$a = 'Changed a String Again';
echo '<br />';
echo 'c = '. $c .'<br />';
echo 'd = '. $d .'<br />';
?>
The output being:
c = This is a string
d = This is a string
c = Changed a String
d = This is a string
c = Changed a String Again
d = This is a string
This basically means that references to references (why you would use this though is beyond me),
doesn't make a reference of the reference variables reference (etc... if you know what I mean),
but is basically a copy of the reference to the 'real' variable.
----
Manual Page -- http://www.php.net/manual/en/language.references.whatdo.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52835
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52835&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52835&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52835&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52835&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52835&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52835&report=yes
Search -- http://master.php.net/manage/user-notes.php