|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-02-26 09:52 UTC] yohgaki@php.net
[2002-03-01 12:13 UTC] sander@php.net
[2002-06-18 19:27 UTC] sniper@php.net
[2003-03-11 18:22 UTC] postings dot php dot net at hans dot spath dot de
[2003-03-11 19:05 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 06:00:01 2025 UTC |
I tried to access the autoglobal variables via the variable variables 'trick'. But that doesn't work within functions. Examples: That works: <? ?><hr><? $test1 = '_TEST'; $test2 = '_SERVER'; $_TEST = '[test1]'; ?><pre><? var_dump( $test1 ); var_dump( ${'_TEST'} ); var_dump( ${$test1} ); var_dump( ${"$test1"} ); ?><hr><? var_dump( $test2 ); var_dump( ${'_SERVER'} ); var_dump( ${$test2} ); var_dump( ${"$test2"} ); ?></pre><hr><? That doesn't work: <? function foolme() { ?><hr><? $test1 = '_TEST'; $test2 = '_SERVER'; $_TEST = '[test1]'; ?><pre><? var_dump( $test1 ); var_dump( ${'_TEST'} ); var_dump( ${$test1} ); var_dump( ${"$test1"} ); ?><hr><? var_dump( $test2 ); var_dump( ${'_SERVER'} ); var_dump( ${$test2} ); var_dump( ${"$test2"} ); ?></pre><hr><? } foolme(); -- I found that, while writing a class for processing html forms: function __wakeup() { $method = $this->_method; $this->_FORM = &${"_$method"}; }