note 123935 added to language.references.arent

From: Date: Thu, 13 Jun 2019 01:36:09 +0000
Subject: note 123935 added to language.references.arent
Groups: php.notes 
Request: Send a blank email to php-notes+get-211246@lists.php.net to get a copy of this message
<?php function foo(&$var) { $var =& $GLOBALS["baz"]; } foo($bar); ?> Let's re-write the above snippet of code in another way <?php $bar = &$var; // At this time, $bar refers to the content to which $var refers which is NULL or empty $var = & $GLOBALS["baz"]; // At this time, $var changes to refer to another content to which global $baz variable refers. However $bar is still refers to the content of NULL Expected Result: $bar will hold the content of $var (which is now the content of $baz) Actual Result: $bar holds a content of NULL or empty. This is what's PHP References does ---- Server IP: 208.43.231.9 Probable Submitter: 185.85.3.195 (proxied: 115.75.6.46) ---- Manual Page -- http://php.net/manual/en/language.references.arent.php Edit -- https://master.php.net/note/edit/123935 Del: integrated -- https://master.php.net/note/delete/123935/integrated Del: useless -- https://master.php.net/note/delete/123935/useless Del: bad code -- https://master.php.net/note/delete/123935/bad+code Del: spam -- https://master.php.net/note/delete/123935/spam Del: non-english -- https://master.php.net/note/delete/123935/non-english Del: in docs -- https://master.php.net/note/delete/123935/in+docs Del: other reasons-- https://master.php.net/note/delete/123935 Reject -- https://master.php.net/note/reject/123935 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#211246) next »