akbkhome

Smoking toooooo much PHP



__autoload() is your friend
I disagree on the question if __autoload() is useful or not.

I find __autoload() to be a great tool that complements how PEAR may be able to work. Using __autoload() you gain more control over what code gets included where. 蛅 also allows users from getting rid of the include_path directive which we rely on to give the user a little more control today.

Overall I would say __autoload() is no more magic than the include_path directive. However it is more flexible and affects performance less.
#1 - Lukas ( Link) on 17 Mar 2005, 23:18 Delete Comment
class_exists is useful
Checking if the class exists before including it is useful from a customization standpoint, since it allows you to hack up the PEAR class and include it before the other code, without having to create some crazy include path.

I'm not sure about __autoload() for PEAR but its made sense for all the php5 apps i've written so as long as its easy to override there shouldn't be any problems.
#2 - Joshua Eichorn ( Link) on 18 Mar 2005, 00:27 Delete Comment
Maybe a include_once Wrapper Class?
This is good for the inclusion of classes, but what about othre code?

You can also use some kind of wrapper function, for expample this wrapper class. http://www.pure-php.de/node/19

include_once("includeWrapper.class.php")

includeHandler::includeOnce("Class1.class.php");
includeHandler::requireOnce("Class1.class.php");
includeHandler::includeOnce("Class2.class.php");
#3 - Pure-PHP ( Link) on 18 Mar 2005, 06:07 Delete Comment


Name
Email
Homepage
Comment Title
Comment
 
Contact me at alan@akbkhome.com