Skip to content

Instantly share code, notes, and snippets.

@pedrochaves
Created July 15, 2015 01:31
Show Gist options
  • Save pedrochaves/822db2f588da7ee5d882 to your computer and use it in GitHub Desktop.
Save pedrochaves/822db2f588da7ee5d882 to your computer and use it in GitHub Desktop.
autoloading
<?php
// config.php
include_once 'a.class.php';
include_once 'b.class.php';
include_once 'c.class.php';
include_once 'd.class.php';
// index.php
include 'config.php';
$a = new A();
<?php
function __autoload($classname)
{
include_once $classname . '.class.php';
}
$a = new A();
$b = new B();
$c = new C($b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment