Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:14449 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23366 invoked by uid 1010); 28 Jan 2005 23:42:35 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 23351 invoked by uid 1007); 28 Jan 2005 23:42:35 -0000 Message-ID: <20050128234235.23316.qmail@lists.php.net> To: internals@lists.php.net Date: Sat, 29 Jan 2005 00:42:31 +0100 User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 References: <20050128223155.81436.qmail@lists.php.net> <5.1.0.14.2.20050128145327.04025190@localhost> <20050128233054.9657.qmail@lists.php.net> In-Reply-To: <20050128233054.9657.qmail@lists.php.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 217.86.69.74 Subject: Re: [PHP-DEV] Using Superglobals for variable variables works From: michael.virnstein@brodos.de (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 class methods." i tested it and it is true, you can't used it inside functions, because the variable would not reference to the superglobal variable this way. the output is NULL Anyway, thanks for your time. ;) Regards, Michael Michael Virnstein 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 > > $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: >>> >>> >> >>> $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