PHP5: Autoloading your magic!

..contributing to IT in London since 2002..

PHP5: Autoloading your magic!

__autoload() function can be very useful to optimize your code esp. when you have so many classes.

Unlike class extensions, optional parameters with class restrictions may not load your class.

So, it’s very encouraging to use classes everywhere!
Even encapsulating your functions inside simple classes to use like static modules, will help a lot!

Let’s say, you have 50k lines of code inside 100 classes/files.. If you need a simple task to do very quickly, you should not be loading all of those files, except the ones you need.

Though, it may be dangerous on some cases regarding the dependencies, load order, etc. Carefully design your classes.

Check this:


No Comments

Add your comment