Koobazaur Posted August 13, 2007 Share Posted August 13, 2007 Hi, I have several PHP files that create global objects and refers to some global objects. I wanted to create a function that would allow me to dynamically include those files at any point in the code. However, the problem is that the created objects are then created within the scope of the function (hence essentailly useless since they're not available outside) and I can't even initialize some of the objects because they require other global objects which, since the file is included via a fuctnion, are no longer in scope. I was wondering if there was any easy way to change the scope of a function to global or change the scope of the included file to global without having to define every single variable as global in the function or the included files. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/64635-local-to-global-scope-of-included-files/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.