[PHP-DEV] Using Superglobals for variable variables works

2005-01-28 Thread Michael Virnstein
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: $a = 'hello world'; echo ${$_GET['test']}; ?> Actually it does work. Is this intended now? Would be nice,

Re: [PHP-DEV] Using Superglobals for variable variables works

2005-01-28 Thread Andi Gutmans
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 somethin

Re: [PHP-DEV] Using Superglobals for variable variables works

2005-01-28 Thread Michael Virnstein
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 $a = '_GET'; echo ${$a}['test']; var_dump($$a); ?> the output is: works array(1) { ["test"]=> string(5) "works" } Andi Gut

Re: [PHP-DEV] Using Superglobals for variable variables works

2005-01-28 Thread Michael Virnstein
ok, sorry, now i have it. i read the german manual version first and that says that you can't use what i said. The german is wrong and the english version of the manual has it right. It says: "Please note that variable variables cannot be used with PHP's Superglobal arrays within functions or c

Re: [PHP-DEV] Using Superglobals for variable variables works

2005-01-28 Thread Sara Golemon
> 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 > $a = '_GET'; > echo ${$a}['test']; > var_dump($$a); > ?> > It works when you're already at the global scope, but try

[PHP-DEV] Re: How to detect GD in source code.

2005-01-28 Thread Sara Golemon
> I've been writing a module, it is dependent on some GD functions, how > can I detect that GD has been installed PHP native? > Taking a page out of Zend/zend_builtin_functions and the source code for the extension_loaded() userspace function: int gd_is_loaded = zend_hash_exists(&module_regist

Re: [PHP-DEV] Using Superglobals for variable variables works

2005-01-28 Thread Michael Virnstein
yep, figured it out already. Problem is the german version of the manual. It is wrong and doesn't say anything about functions and methods. It simply says you can't use superglobals for variable variable and uses a illogical example ${$_GET}, whatever that should mean ;). The english manual is