- spl_autoload_register: documentation ( source)
- debug_backtrace: documentation ( source)
- class_exists: documentation ( source)
<?php
function autoLoadClass($name) {
foreach(debug_backtrace() as $call) {
if(!array_key_exists('type', $call) && $call['function'] == 'class_exists') {
return;
}
}
echo 'spl_autoload_register: ', $name, '<br>';
}
spl_autoload_register('autoLoadClass');
class_exists('Foo');
class_exists('Bar');
class_exists('Foo\\Bar');