PHP set_exception_handler() Function

PHP set_exception_handler Function


Define:

In this topic we have to learn PHP set_exception_handler() Function.The set_exception_handler() Function is inbuilt function.

This function sets a user-defined exception handler function and script will stop executing after the exception handler is called.

Syntax :

  set_exception_handler(exceptionhandler);

Parameter
Parameter Description
exceptionhandler Required. 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

Given below example to show set_exception_handler() Function

Output : Exception: Uncaught exception occurred!