Re: include file to global scope
| From: | Jochem Maas | Date: | Wed, 12 Oct 2005 09:26:01 +0000 |
| Subject: | Re: include file to global scope | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-223947@lists.php.net to get a copy of this message | ||
Claudio wrote:
Hi, I'm using PHP 5. I have a class operation that includes php files. Is there a way to include this files to global scope? So that difined vars and functions are global accesseble?first off I would recommend that you 'pollute' your global scope as little as possible. secondly could you describe what you are trying to do and why exactly - stuff like this has been solved before but its hard to recommend a strategy when one doesn't know what the underlying idea/direction is .... that said the solution will probably involve the use of the 'global' keyword.
I saw that some PHP functions have a context parameter, is something like this in "eval" or "include" possible?I think you mean then 'context' param related to functions that work with streams - this is not AFAIK related to [variable] 'scope'. also eval() sucks (unless there is no other way to do something, in which case its lovely ;-).
Thanks, Claudio