Skip to content

Instantly share code, notes, and snippets.

@masakielastic
Created February 19, 2009 11:50
Show Gist options
  • Save masakielastic/66881 to your computer and use it in GitHub Desktop.
Save masakielastic/66881 to your computer and use it in GitHub Desktop.
<?php
class Autoload
{
static public function loadClass($className)
{
require_once($className . '.class.php');
}
static public function getInstance()
{
spl_autoload_register(array(self, 'loadClass'));
}
}
// usage
Autoload::getInstance();
// symfony
require_once 'symfony/autoload/sfCoreAutoload.class.php';
sfCoreAutoload::register();
// Zend Framework
require_once 'Zend/Version.php';
if(Zend_Version::compareVersion('1.8.0')>=0)
{
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
}
else
{
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment