//test.php <?php
$a = '_GET';
echo ${$a}['test'];
var_dump($$a);
?>
the output is:
works array(1) { ["test"]=> string(5) "works" }
Andi Gutmans wrote:
The idea is that the following doesn't work by design: $a = "_GET"; var_dump($$a);
At 11:31 PM 1/28/2005 +0100, Michael Virnstein wrote:
Hi PHP-Devs,
i don't know if it is a bug or a new feature of php5. The php manual says, that using superglobals for variable variables isn't working, so something like this shouldn't work:
<?php
$a = 'hello world';
echo ${$_GET['test']};
?>
Actually it does work. Is this intended now? Would be nice, but if it is a simple bug and i can't rely on it to work in the future, i won't use it. Hope it is a feature though. ;)
Regards, Michael
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php