Hello,
I am currently working on a project that contains many different class files which are currently instantiated when they are needed. We also have a settings file that is called on every page load. I was thinking (for brevity and simplicity) to move the instatiation of ALL classes over to the settings file so every class is each time rather than only when needed. I was wondering what kind of overhead this might cause and if anyone has any suggestions as why this might be a bad idea.
Thanks!
Classes, right now, are expensive in resources within PHP, so I wouldn't suggest instantiating any class that you don't need...
Diego
All in all you don't have to instantiate a class before you want to use it. It sounds like you're talking about including the files where those classes are defined though. If that is the case what you're proposing should be just fine. Granted I think you would increase overhead but things might be a little easier.
I'll just keep it the same. Only thing I was trying to do I guess is make sure that a class is always availble, no matter what.
Thanks