Ah, there you have it! So it can be done.
I have tested it, and it works like a charm. Here is what I did;
I made 2 files that called two classes and two methods each, in the one class file I filled the one method with junk until I reached 3MB, the other method I made simple and very empty (this is the method I call). The other class file I did the same but I did your trick the junk was now in a supporting method in another file.
When I didnt even call the method with the junk in only the second simple method, the file loaded slow. The other one which included your trick, was immediate, so guess what, this is the solution.
Weedpacket wrote:Here's a rude trick I concocted some time back to pull in a class only when needed:
class aClass {
//...
function aMethod()
{
require_once('supportingClass.php');
supportingClass::supportingMethod();
}
...
}
The real one was a little more elaborate (the full story is here).
@ NogDog, this is a great solution in certain situations as well!
@ Qsan, what a great feature I did not even know of, well worth checking out.