Lazy Loading in php with spl_autload

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");
This entry was posted in Code, PHP. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>