autoload class
The __autoload() magic function is used to dynamically load classes. Whenever PHP encounters a non-existent class, it will first call the __autoload() function, and only then declare an error. This can be used to load classes on-the-fly. error_reporting (E_ALL); if (version_compare(phpversion(), '5.1.0', '<') == true) { die ('PHP5.1 Only'); } // Constants: define ('DIRSEP', DIRECTORY_SEPARATOR); // Get site path $site_path = realpath(dirname(__FILE__) . DIRSEP . '..' . DIRSEP) . DIRSEP; define ('site_path', $site_path); $registry = new Registry; // Set some data $registry->set ('name', 'Don'); // Get data, using get() echo $registry->get ('name'); // Get data, using array access echo $registry['name'] function __autoload($className) { // Assume that all class files are located in the same dir and subdirs $fname = str_replace('::', DIRECTORY_SEPARATOR, $className) . '.php...