Re: Variable Variables adn Superglobals

From: Date: Thu, 05 Aug 2004 02:11:26 +0000
Subject: Re: Variable Variables adn Superglobals
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-192785@lists.php.net to get a copy of this message
* Thus wrote ARico: > Using Variable Variables works fine inside functions for global > defined variables if you declare them as global inside the function. > Suprinsingly, it does not seem to work with superglobals. Take the > following example: > > // code //////////////////////////////////////////////////////////// > ... > // End ////////////////////////////////////////////////// > > I'm doing something wrong? Or this is the expected behavior? I know > I could use php references, but linking style does confuse me a bit ( > how do you change a reference to point to a new variable if it's > allready referencing another one ? ) This is expected behaviour and is noted in the manual as well: http://php.net/variables.predefined <manual> Variable variables: Superglobals cannot be used as variable variables inside functions or class methods. </manual> Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid!

« previous php.general (#192785) next »