note 61300 added to language.references.arent

From: Date: Mon, 30 Jan 2006 19:27:21 +0000
Subject: note 61300 added to language.references.arent
Groups: php.notes 
Request: Send a blank email to php-notes+get-102745@lists.php.net to get a copy of this message
In response to the example by mdiricks. Extending the example given by mdiricks, the following code provides an explains the concept of re-referencing that is involved in making a call to function foo with the prototype foo(& var): <!-- C re-referenced --> <? $a = 'eh'; $b = & $a;// $b == 'eh' $c = & $b;// $c == 'eh' $d = 'meh'; echo "\$a = $a\n"; echo "\$b = $b\n"; echo "\$c = $c\n"; echo "\$d = $d\n"; $c = & $d ;// $c == 'meh' echo "\n"; echo "\$a = $a\n"; echo "\$b = $b\n"; echo "\$c = $c\n"; echo "\$d = $d\n"; ?> <!-- Value of c changed --> <? $a = 'eh'; $b = & $a;// $b == 'eh' $c = & $b;// $c == 'eh' $d = 'meh'; echo "\$a = $a\n"; echo "\$b = $b\n"; echo "\$c = $c\n"; echo "\$d = $d\n"; $c = 'meh' ;// $c == 'meh'. And also, $a = $b == 'meh' echo "\n"; echo "\$a = $a\n"; echo "\$b = $b\n"; echo "\$c = $c\n"; echo "\$d = $d\n"; ?> This results in the following o/p: <!-- C re-referenced --> $a = eh $b = eh $c = eh $d = meh $a = eh $b = eh $c = meh $d = meh <!-- Value of c changed --> $a = eh $b = eh $c = eh $d = meh $a = meh $b = meh $c = meh $d = meh ---- Server IP: 64.246.30.37 Probable Submitter: 166.32.192.163 ---- Manual Page -- http://www.php.net/manual/en/language.references.arent.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61300 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61300&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61300&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61300&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61300&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61300&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61300&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61300&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61300&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102745) next »