note 57827 added to function.include

From: Date: Sat, 15 Oct 2005 07:13:16 +0000
Subject: note 57827 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-97053@lists.php.net to get a copy of this message
I've been trying to figure out how to include files within a function and have them operate within the global scope. Until now, I've been writing all my include files to work with $GLOBALS['some_global_var'] ... but I just realized that there's another way... <? foreach(array_keys($GLOBALS) as $index => $key){ eval("$key = & $GLOBALS[$key];"); } ?> Please feel free to comment on this. ---- Manual Page -- http://www.php.net/manual/en/function.include.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57827 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57827&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57827&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57827&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57827&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57827&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57827&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57827&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57827&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#97053) next »