note 11623 deleted from language.variables.variable by irc-html

From: Date: Sat, 19 Jan 2002 18:56:26 +0000
Subject: note 11623 deleted from language.variables.variable by irc-html
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-25209@lists.php.net to get a copy of this message
[Ed: Scoping is identical to 'normal' variables.] This manual never seems to mention how scoping applies to variable variables. From what I can tell, variable variables are scoped to the nearest enclosing function (not to the nearest enclosing block, thankfully). function test() { do { $varname = 'text'; $$varname = 'testing 1,2,3'; while(0); print $text; } will give you 'testing 1,2,3'. This may be confusing to people who are used to stricter scoping rules.

« previous php.notes (#25209) next »