Skip to content

Instantly share code, notes, and snippets.

@rahilwazir
Created May 27, 2014 16:27
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 rahilwazir/d94190cb231c7a0b0214 to your computer and use it in GitHub Desktop.
Save rahilwazir/d94190cb231c7a0b0214 to your computer and use it in GitHub Desktop.
Autoloader PHP Classes with Namespace
namespace SearchBlox;
function spl_autoloader($class)
{
$file = RW_DIR . 'classes/' . str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
if (file_exists($file)) {
include_once $file;
}
}
spl_autoload_register(__NAMESPACE__ . '\spl_autoloader');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment