Easy Tutorial
❮ Func Math Fmod Func Array Diff Assoc ❯

PHP set_exception_handler() Function



Definition and Usage

The set_exception_handler() function sets a user-defined function for handling exceptions.

This function is used to create a custom exception handling method during runtime.

It returns the old exception handler, or NULL on failure.

Syntax

Parameter Description
exception_function Required. Specifies the function to be called when an uncaught exception occurs. This function must be defined before calling set_exception_handler(). The exception handling function requires one parameter, which is the thrown exception object.

Tips and Notes

Tip: The script stops executing after this exception handler is called.


Example

The output of the above code is as follows:


❮ Func Math Fmod Func Array Diff Assoc ❯