note 52795 deleted from language.variables.scope by sean
| From: | sean@php.net | Date: | Fri, 17 Jun 2005 00:29:11 +0000 |
| Subject: | note 52795 deleted from language.variables.scope by sean | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-90559@lists.php.net to get a copy of this message | ||
Note Submitter: dpk at dpk dot net
----
This may have been covered in some other way, but I'm not certain. When you assign an array to
a $GLOBALS member, and then assign a variable to that array, you somehow destroy the data inside of
$GLOBALS, contrary to what you'd expect:
$GLOBALS['foo'] = array ('bar' => 'frank');
print $GLOBALS['foo']['bar'];
print "\n";
$foo = $GLOBALS['foo']['bar'];
print "$foo\n";
print $GLOBALS['foo']['bar'];
print "\n";
prints:
frank
frank
f
rather than "frank frank frank". I don't know how to fix this, so I'm just
posting this so others know what to expect.