Suppose you are building a web application that is going to be a packaged product one day, one that users will want to be able to extend and customize.
It comes with
I think it's more complicated with a single filename when you want to use inheritance as well. Basically class user_frontend extends core_frontend
has to know where to find both classes. Both must be included.
If you just want to do new Frontend
you could use PHP5.3's class_alias to point Frontend to the main class to use. Below 5.3. you could use a ServiceFinder, that knows how to map Service Names to Classes and then get the Frontend with $service->get('frontend')
or use a Dependency Injection framework.
Edit I removed the Loader code given before, because it was suffering from exactly this problem.