note 117306 deleted from function.unset by peehaa
| From: | peehaa@php.net | Date: | Wed, 20 May 2015 12:42:12 +0000 |
| Subject: | note 117306 deleted from function.unset by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-202620@lists.php.net to get a copy of this message | ||
Note Submitter: mike at eastghost dot com
----
beware unset() destroys references
(this is already noted but not as plainly)
$x = 'x';
change( $x );
echo $x; // outputs "x" not "q23" ---- remove the unset() and output is
"q23" not "x"
function change( & $x )
{
unset( $x );
$x = 'q23';
return true;
}