Name
set_exception_handler
Synopsis
string set_exception_handler(callback function
)
Sets the named function as the current exception handler. The
exception handler is called whenever an exception is thrown in a
try
/catch
block, but is not caught; the
function can do whatever it wants, but typically will print an error
message and clean up after a critical error happens.
The user-defined function is called with one parameter—the exception object that was thrown.
set_exception_handler( )
returns the name of the previously installed exception-handler
function, an empty string if no previous handler was set, or
false
if an error occurred while
setting the error handler (e.g., when
function
doesn’t exist).
Get Programming PHP, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.