set_exception_handler
Set user-defined exception handling functions
set_exception_handler()
function sets a user-defined exception handling function.
The script will stop executing after this exception handler is called.
Set user-defined exception handling functions:
<?php // User-defined exception handling function function myException ( $exception ) { echo "<b>Exception:</b> " , $exception -> getMessage ( ) ; } // Set user-defined exception handling function set_exception_handler ( "myException" ) ; // throw an exception throw new Exception ( "Uncaught exception occurred!" ) ; ?>
The output of the above code is similar to this:
Exception: Uncaught exception occurred!