Jump to content

Local to Global scope of included files?


Koobazaur

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/64635-local-to-global-scope-of-included-files/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.