Re: PHP 4.0 Bug #6191: Can't return global variable when defined with a dynamic name using eval

From: Date: Wed, 16 Aug 2000 02:27:13 +0000
Subject: Re: PHP 4.0 Bug #6191: Can't return global variable when defined with a dynamic name using eval
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-29089@lists.php.net to get a copy of this message
Why not do this? function _global($__name) { return $GLOBALS[$__name]; } That works without using global or eval(). -John At 2:21 +0000 8/16/00, smaug@thegame.com wrote:
this doesn't work: function _global($___name) { eval('global $' . $___name . ';'); eval('return $' . $___name . ';'); }
--- John Bafford dshadow@zort.net http://www.dshadow.com/

« previous php.dev (#29089) next »