On Saturday 05 July 2008 2:25:20 pm Pulni4kiya wrote: > First of all, I don't think using autoload is recommended. Why not? I know there is a performance hit for the lookup time, but for the system I'm working on I have already solved that issue with selective pre-caching. > If you really want to do it that way, you could check if the file which > autoload will try to include exists and if it does, include it and create > your object. Well yes, but then I'm not using autoload at all. I may as well just include_once() and class_exists(), which is what I'm trying to avoid, both for code cleanliness and performance (include_once() has its own performance issues). > Actually to make the script more safe, after including the file you should > check if the class exists (because the file might exist but not have the > class in it) and only then you can make the object of that class. > > I suppose you could throw the exception you want and do it with the > try-catch as you like it :) Again, that's basically just reimplementing autoloading in user-space, which defeats the purpose. If I know exactly which autoload routine would be responsible for loading a given class, can I do the check in that autoload routine and throw an exception there? Or would that make insanity happen? :-) -- Larry Garfield larry@xxxxxxxxxxxxxxxx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php