Exception Based Class Loading in PHP

Audentio

New Member
So I have an idea, but I'm thinking I need to run it by StackOverflow before I do something stupid.I want to have an associative array of class names => filepaths. If PHP ever runs into a fatal error where the class is not defined, it will check if the key exists in my array and then require_once the class. This will prevent unnecessary bulk loading of classes that may never be used.Bad idea?
 
Back
Top