Name
set_error_handler
Synopsis
string set_error_handler(string function)Sets the named function as the current error handler, or unsets
the current error handler if function is
NULL. The error-handler function is
called whenever an error occurs; 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 two parameters, an error code and a string describing the error. Three additional parameters may also be supplied—the filename in which the error occurred, the line number at which the error occurred, and the context in which the error occurred (which is an array pointing to the active symbol table).
set_error_handler() returns
the name of the previously installed error-handler function, or
false if an error occurred while
setting the error handler (e.g., when
function doesn’t exist).
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access