Skip to content

Instantly share code, notes, and snippets.

@dwihujianto
Created October 8, 2015 12:10
Show Gist options
  • Save dwihujianto/0ba1b6811b86e112a846 to your computer and use it in GitHub Desktop.
Save dwihujianto/0ba1b6811b86e112a846 to your computer and use it in GitHub Desktop.
Autoload with Namespace
<?php
spl_autoload_register(function($class){
$path = str_replace('\\', '/', $class);
require_once $path.'.php';
});
/* Namespace must same with your directory */
use Core\Common\Router;
new Router;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment