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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.