PHP set_exception_handler() Function

The set_exception_handler() function sets a user-defined exception handler function.The script will stop executing after the exception handler is called.set_exception_handler — Sets a user-defined exception handler function

callable set_exception_handler ( callable $exception_handler )

Sets the default exception handler if an exception is not caught within a try/catch block. Execution will stop after the exception_handler is called.

Example -

ParameterDescription
exceptionhandlerRequired. Specifies the name of the function to be run when an uncaught exception occurs. NULL can be passed instead, to reset this handler to its default state