PHP __Autoload Function


When PHP encounters a class that hasn’t been defined yet, you can use __autoload to automatically add them instead of including masses of included at the top of your files.

e.g.

function __autoload($class_name) {
  require_once $class_name . '.php';
}