- set_exception_handler: documentation ( source)
<?php
class Handler {
public function register() {
return set_exception_handler([$this, 'handle']);
}
public function handle($e) {
die("Exception reached");
}
}
$h = (new Handler())->register();
throw new Exception("Not handled");