/ Published in: PHP
URL: http:://silviud.blogspot.com
Expand |
Embed | Plain Text
/* Autoload for php classes with a simple convention so you don't have to include manually files. The convention is as follow: '_' gets converted into '/' and the strings before and after '_' become directories or files. For example Process_Shell class is located under directory Process and the file name that contains the class Process_Shell is called Shell.php. The classname is Process_Process and is located into Process/Shell.php. */ function __autoload($class){ require_once($path . '.' . 'php'); }
Comments
Subscribe to comments
You need to login to post a comment.

Although convenient, using magic functions like __get(), __set() and __autoload() should be avoided at possible as they can hinder performance. Also, use of require_once() is very expensive.