note 27894 added to migration4.variables

From: Date: Mon, 23 Dec 2002 18:09:54 +0000
Subject: note 27894 added to migration4.variables
Groups: php.notes 
Request: Send a blank email to php-notes+get-41231@lists.php.net to get a copy of this message
Better (and likely more correct) way to look at it is this: In php3, the global statement caused named variables to become aliases. In php4, the global statement constructs references. In php3, there are no references. In php4, references are what get unset, not the pointed-to values. The same change affects function parameters passed by reference. In php3, you got aliases. In php4, you get references. If you unset a reference, then you've lost only the reference. The original variable remains. function foo(&$bar) { unset($bar); $bar = 27; } $x = 5; foo($x); assert($x == 5); -- http://www.php.net/manual/en/migration4.variables.php http://master.php.net/manage/user-notes.php?action=edit+27894 http://master.php.net/manage/user-notes.php?action=delete+27894 http://master.php.net/manage/user-notes.php?action=reject+27894

« previous php.notes (#41231) next »