note 68393 deleted from language.variables.scope by bjori

From: Date: Tue, 05 Sep 2006 08:11:24 +0000
Subject: note 68393 deleted from language.variables.scope by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-116674@lists.php.net to get a copy of this message
Note Submitter: wilco dot ict at schippers dot nl ---- I was building a class, which would let the user include a file at one point. The included file needed to be function on a global level though, and not as part of the function. So i came up with this little trick to work around that. <?php // class private function myInclude() { // Dirty little trick to turn the scope of this function to a global scope. foreach ($GLOBALS as $key => $value) { $$key =& $GLOBALS[$key]; } include $this->myInclude; } ?>

« previous php.notes (#116674) next »