SPL autoloading in PHP - Antoine Ughetto

Courtesy Planet PHP  Mon, 04/21/2008 - 04:44

In php5 we have a fabulous new feature, autoloading Objects .

This function load dynamically classes.Before this magic function, we had to include all needed files before using an object.
How it works ?

Very simple :

function __autoload( $class ) {   if ( is_file ( $class . '.php' ) ) {   require_once $class .'.php' ;   } ...


 

More related items

DevShed: Sub Classing Exceptions in PHP 5
DevShed has start up a new series today with the first part in a four-part series looking at exception handling in PHP5. If you do any serious programming, whether it's in PHP 5 or some...

TotalPHP: Using an autoload function to make your...
On the TotalPHP blog there's a recent post introducing you to a feature in PHP5 that can make life much easier - autoload. In PHP 5 you can make your life a lot easier by writing an...

Debuggable Blog: Installing PHP5.3 via MacPorts
On the Debuggable blog, Felix Geisendorfer has a quick post showing the (basically) one step installation of the latest development version in the PHP 5 series, PHP 5.3. I'll share an easy...

SimpleTech 120GB USB2.0 5400 RPM Portable Hard Drive...
Its sleek lines and ultra-low profile styling makes you want to put it on a shelf and stare, but it easily slides into your pocket for ultimate portability.The new SimpleDrive portable has...

Mac OS X Leopard: The Missing Manual
With Leopard, Apple has unleashed the greatest version of Mac OS X yet, and David Pogue is back with another meticulous Missing Manual to cover the operating system with a wealth of detail....


 

Post new comment

The content of this field is kept private and will not be shown publicly.
computer-internet.marc8.com