- spl_autoload_register: documentation ( source)
- printf: documentation ( source)
<?php
spl_autoload_register(function() {
eval('class Foo {'); // syntax error
});
spl_autoload_register(function() {
throw new Exception();
});
try {
new Widget();
} catch (Throwable $t) {
for ($i = 1; $t; $t = $t->getPrevious()) {
printf("#%d %s: %s in %s:%d\n", $i++, get_class($t), $t->getMessage(), $t->getFile(), $t->getLine());
}
}