{Dev Tricks} » PHP http://dev-tricks.net Blogging developper tips and tricks Sun, 30 Aug 2009 00:14:47 +0000 http://wordpress.org/?v=2.9.2 en hourly 1 Lazy Loading in php with spl_autload http://dev-tricks.net/lazy-loading-in-php-with-spl_autload http://dev-tricks.net/lazy-loading-in-php-with-spl_autload#comments Sun, 16 Nov 2008 18:40:44 +0000 Julien Palard http://dev-tricks.net/?p=51 Today, a very short post about the lazy loading in PHP : spl_autoload
I’ll not expose everything about it here, cause it’s already done here :
http://php.net/autoload

Basically, a Lazy Loading allow you to predifine some paths where PHP should seek for classes to include, this allow you to directly instantiate an object without having included its file.

public static function lazyLoad($strClassName)
{
        /* some work to find the file to include mixing strClassName */

        /* include your files here... */
}
spl_autoload_register("lazyLoad");

Download this code: lazy.php

]]>
http://dev-tricks.net/lazy-loading-in-php-with-spl_autload/feed 0