Skip to content

Instantly share code, notes, and snippets.

@racztiborzoltan
Created February 12, 2017 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save racztiborzoltan/9cf287b78a1c80a69944a1f57b5ba4fb to your computer and use it in GitHub Desktop.
Save racztiborzoltan/9cf287b78a1c80a69944a1f57b5ba4fb to your computer and use it in GitHub Desktop.
Simple PSR0 autoloader function
<?php
spl_autoload_register(function($class_name){
$path = realpath(__DIR__.'../../classes/'. str_replace('\\', '/', $class_name).'.php');
if ($path) {
require_once $path;
}
return class_exists($class_name, false);
}, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment