News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Jaisen Methai's Blog:
Stop including class files and use __autoload() instead
July 02, 2008 @ 11:11:50

On his blog, Jaisen Methai posted about a very handy feature of PHP5 - the __autoload function.

It's one of the gems in PHP that I find to be relatively under used. It's common for PHP applications to break out classes into their own files. This becomes cumbersome when working on large projects as you wind up with numerous include/require calls for any given page.

He shows an example of its usage (loading class files dynamically from a specified directory) and mentions how it can help to make your code a lot less ugly. Comments on the post range in topics - from comparing it to include paths, how the idea was borrowed from PEAR, and how proper naming conventions can make its use even easier.

2 comments voice your opinion now!
include class file autoload php5 tip


blog comments powered by Disqus

Similar Posts

Brian Nelson's Blog: Writing A Reverse Proxy in PHP5

Gergely Hodicska's Blog: What is new in PHP 5.3 - Part 4

PHP.net: PHP 5.3.0 Released!

ThinkPHP Blog: Spooky Action at not so much Distance

Fabien Potencier's Blog: On PHP 5.3, Lambda Functions, and Closures


Community Events





Don't see your event here?
Let us know!


list interview opinion release community podcast developer framework testing introduction install series configure threedevsandamaybe laravel refactor symfony2 unittest code language

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework