- spl_autoload_register: documentation ( source)
- substr: documentation ( source)
- ltrim: documentation ( source)
- strpos: documentation ( source)
- str_replace: documentation ( source)
- strlen: documentation ( source)
- file_exists: documentation ( source)
<?php
namespace a;
spl_autoload_register(function ($class) {
echo $class . "\n";
if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\EventDispatcher')) {
if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\EventDispatcher')).'.php')) {
require_once $file;
}
}
});
new \a\doesntexist;