Hi, I'm new. :o Hope you guys can help me out here.
I'm working with classes since a couple of weeks now, after programming without classes for about 2.5 year. Basically this means I have quite a structure for using non-OOP, and lack structure for OOP.
I work with PHP 4.4 for now.
My problem;
I often like to create structures that require a lot of classes. much like a spider in the web, the spider being the core. So from that core, I'd like the ability to reach every other class I have created. Of course, I can initiate every class every time I'd like. But take this for example;
Right now I have a Loader class, which will require() files. But everytime I'm within another class, I have to re-intiate this class ($loader = new Loader; ). This doesn't seem like good practice to me. I'd rather have the ability to use the already initiated class, from wherever I'd like. So for example the core initiates the Loader class, and class1, class2, class3, etc, that are loaded from the core, can use the same Loader.
Please note that there's more to it than what I've written down here, so please don't try to work around the requiring issue 😉 it's about the structure. How to reuse certain classes, or being able to prevent the re-initialisation of a class.
Hope it's a bit clear. Thanks!