Using the 'set_exception_handler' function within a class, the defined 'exception_handler' method must be declared as 'public' (preferrable 'public static' if you use the "array('example', 'exception_handler')" syntax).
<?php
class example {
public function __construct() {
@set_exception_handler(array('example', 'exception_handler'));
throw new Exception('DOH!!');
}
public static function exception_handler($exception) {
print "Exception Caught: ". $exception->getMessage() ."\n";
}
}
$example = new example;
echo "Not Executed\n";
?>
Declaring the 'exception_handler' function as 'private' causes a FATAL ERROR.
[derick: red. updated statement about static a bit]