Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:11935 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72546 invoked by uid 1010); 5 Aug 2004 14:17:32 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 72517 invoked by uid 1007); 5 Aug 2004 14:17:32 -0000 Message-ID: <20040805141732.72516.qmail@pb1.pair.com> To: internals@lists.php.net Date: Thu, 05 Aug 2004 16:14:31 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040514 X-Accept-Language: en-us, en MIME-Version: 1.0 References: <20040804233723.9149.qmail@pb1.pair.com> <5.1.0.14.2.20040804165109.02e94c58@127.0.0.1> In-Reply-To: <5.1.0.14.2.20040804165109.02e94c58@127.0.0.1> X-Enigmail-Version: 0.84.2.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/alternative; boundary="------------070704090906050401080004" X-Posted-By: 212.106.250.8 Subject: Re: [PHP-DEV] Variable Variables and Superglobals From: el3tro2@tiscali.es ("A.Rico") --------------070704090906050401080004 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit What the PHP documentation says about variable variables and superglobals is that you can't use them as a "pointer": /*Warning*/ / Please note that variable variables cannot be used with PHP's Superglobal arrays . This means you cannot do things like ${$_GET}. If you are looking for a way to handle availability of superglobals and the old HTTP_*_VARS, you might want to try referencing them. / what I intended was to use a "normal" globally defined variable to "point" to a superglobal; that, in fact, works in the global scope, but not in the function scope: // Code ////////////////////////////////////////////////////////////// $varvar="_ENV"; echo $_ENV["OS"]; // --> Windows NT echo ${$varvar}; // --> Windows NT foo($varvar); function foo($arg){ $lvar="_ENV"; echo $_ENV["OS"]; // --> Windows NT echo ${$arg}["OS"]; // --> *nothing* echo ${$lvar}["OS"]; // --> *nothing* var_dump( $$arg ); // --> NULL var_dump( $$lvar); // --> NULL } // END ////////////////////////////////////////////////////////////// Regards, A. Rico --------------070704090906050401080004--