HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

get_error_handler

Description

The get_error_handler of Error Handling for PHP gets the user-defined error handler function.

Syntax

get_error_handler(): ?callable

Return

Returns the currently defined error handler (if any). If the built-in error handler is used null is returned.

The returned handler is the exact callable value that was passed to set_error_handler() to define it.

Examples

1 · default

<?

$return = get_error_handler();

var_dump($return);
NULL

2 · user-defined

<?

function handler($errno, $errstr, $errfile, $errline)
{
    echo __FUNCTION__. PHP_EOL.
    "errno: $errno". PHP_EOL.
    "errstr: $errstr". PHP_EOL.
    "errfile: errfile". PHP_EOL.
    "errline: $errline";
}

$callback = "handler";

set_error_handler($callback);

$return = get_error_handler();

var_dump($return === $callback);
bool(true)