Load a PHP Class automatically upon instantiation (PHP5)
1 2 function __autoload($class_name) { 3 require_once("classes/" . $class_name . ".php"); 4 }
Usage:
1 $auth = new Auth;
Will automatically load the file "classes/Auth.php"
DZone Snippets > alexwilliams > autoload
13493 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Alex Williams http://www.alexwilliams.ca
1 2 function __autoload($class_name) { 3 require_once("classes/" . $class_name . ".php"); 4 }
1 $auth = new Auth;