Thanks anyway, Michael
Sara Golemon wrote:
but this does also work, atm. i'm using PHP 5.0.2 on Windows XP with apache 1.3 and if i call my php page with http://localhost/test.php?test=works it works.
//test.php <?php $a = '_GET'; echo ${$a}['test']; var_dump($$a); ?>
It works when you're already at the global scope, but try this:
<?php function foo() { var_dump($_GET); $g = '_GET'; var_dump($$g); }
foo(); ?>
The first var_dump() will work right because $_GET is a superglobal and ZE picks it out of the global context correctly, the second var_dump() will yield a NULL and an undefined index since it will try to access it from the local symbol table and not find it.
Declaring a variable as superglobals is just a hint to the scripting engine to retreive it from the global symbol table rather than the active symbol table (Superglobals, by definition live in the global symbol table).
Your example worked because at the time the variable variable was resolved, the global symbol table WAS the active symbol table.
-Sara
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php