spl_autoload_extensions('.php');
/**
* This will automatically load any class that you instantiate
* without having to declare every class in a separate include
* *using an anonymous function as of PHP 5.3.0
*/
if(version_compare(PHP_VERSION, '5.3.0') >= 0)
{
spl_autoload_register(function ($class)
{
include(__DIR__ . "/class/class.$class.php");
});
}
else
{
function my_autoloader($class)
{
include(__DIR__ . "/class/class.$class.php");
}
spl_autoload_register('my_autoloader');
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.