FUNCTION NAME |
FUNCTION DESCRIPTION |
FUNCTION SYNTAX |
FUNCTION RETURN VALUE |
debug_backtrace()
[debug_backtrace – Generates a backtrace] |
This function generates a PHP backtrace, useful for debugging purposes. |
debug_backtrace(options [optional parameter, with a default value of DEBUG_BACKTRACE_PROVIDE_OBJECT], limit [optional parameter, with a default value of 0]);
[Possible values for the options parameter as of PHP 5.3.6: DEBUG_BACKTRACE_PROVIDE_OBJECT (default); and DEBUG_BACKTRACE_IGNORE_ARGS. As of PHP 5.4.0, the limit parameter can be used to limit the number of stack frames returned.] |
debug_backtrace() : returns an array of associative arrays, with the following elements — function, line, file, class, object, type, and args. |
debug_print_backtrace()
[debug_print_backtrace – Prints a backtrace] |
This function prints a PHP backtrace, useful for debugging purposes. It prints eval() ed stuff, included/required files, and function calls. |
debug_print_backtrace(options [optional parameter, with a default value of 0], limit [optional parameter, with a default value of 0]);
[options can also represent the value DEBUG_BACKTRACE_IGNORE_ARGS. As of PHP 5.4.0, limit can be used to limit the number of stack frames printed.] |
debug_print_backtrace() : no value is returned [VOID]. |
error_clear_last()
[error_clear_last – Clear the most recent error] |
This function clears the most recent [‘last’] errors, making them unable to be retrieved with error_get_last() . |
error_clear_last(); |
error_clear_last() : no value is returned [void]. |
error_get_last()
[error_get_last – Get the last occurred error] |
This function returns [‘gets’] information about the most recent [‘last’] error that occurred. |
error_get_last(); |
error_get_last() : returns an associative array describing the last error, comprised of the following elements: type; message; file; and line. If the error has been caused by a PHP internal function, message begins with its name. Returns NULL if there hasn’t been an error yet. |
error_log()
[error_log – Send an error message to the defined error handling routines] |
This function transmits an error message to the web server’s error log or to a file. Possible message_type values are: 0 [default – sent to PHP’s system logger, the details of which are specified in the error_log configuration directive]; 1 [message is sent via email to the destination address]; 3 [message is appended to the destination address – a newline is NOT automatically added to the end of message]; and 4 [sent directly to the SAPI logging handler]. |
error_log(message, message_type [optional parameter, with a default value of 0], destination [optional parameter], extra_headers [optional parameter]);
[extra_headers is only used when message_type is set to 1. This message type uses the same internal function as mail() does.] |
error_log() : returns TRUE on success; FALSE on failure. This function is NOT binary safe and should NOT contain the null character. base64_encode() , rawurlencode() , or addslashes() should be called as appropriate, prior to calling error_log() . |
error_reporting()
[error_reporting – Sets which PHP errors are reported] |
This function sets the error_reporting directive at runtime. The level remains set for the runtime duration of the script. If level is not set, this function simply returns the current error reporting level. |
error_reporting(level [optional parameter]);
[Using named constants is strongly encouraged for the level parameter’s future proof-ability. Numerical [named] error constants: 1 [E_ERROR]; 2 [E_WARNING]; 4 [E_PARSE]; 8 [E_NOTICE]; 16 [E_CORE_ERROR]; 32 [E_CORE_WARNING]; 64 [E_COMPILE_ERROR]; 128 [E_COMPILE_WARNING]; 256 [E_USER_ERROR]; 512 [E_USER_WARNING]; 1024 [E_USER_NOTICE]; 2048 [E_STRICT]; 4096 [E_RECOVERABLE_ERROR]; 8192 [E_DEPRECATED]; 16384 [E_USER_DEPRECATED]; and 32767 [E_ALL].] |
error_reporting() : returns the old error_reporting level or the current level if no level parameter is passed. |
restore_error_handler()
[restore_error_handler – Restores the previous error handler function] |
This function is used to revert to [‘restore’] the previous error handler (either the built-in or user-defined function) after changing the error handler function using set_error_handler() . |
restore_error_handler(); |
restore_error_handler() : this function always returns TRUE. |
restore_exception_handler()
[restore_exception_handler – Restores the previously defined exception handler function] |
This function is used to revert to [‘restore’] the previous exception handler (either the built-in or user-defined function) after changing the exception handler function using set_exception_handler() . |
restore_exception_handler(); |
restore_exception_handler() : this function always returns TRUE. |
set_error_handler()
[set_error_handler – Sets a user-defined error handler function] |
This function sets a user function [error_handler] to handle errors in a script. The standard PHP error handler will be bypassed for the error types specified by error_types unless the callback function returns FALSE. If the statement that caused the error was prefixed by the ‘@‘ character, the value of error_reporting will be 0. It is the programmer’s responsibility to die() /exit() if necessary; if the error handler function returns, script execution will continue with the statement following the one that caused the error. |
set_error_handler(error_handler, error_types [optional parameter, with a default value of E_ALL | E_STRICT], context [optional parameter]);
[NULL may be passed as the callable error_handler parameter, to reset this handler to its default state; an array containing an object reference and a method name can also be given. Otherwise, error_handler is a callback with the following signature:
handler(errno, errstr, errfile [optional parameter], errline [optional parameter], errcontext [optional parameter]); ] |
set_error_handler) : returns a string containing the previously defined error handler (if any); NULL is returned if the built-in error handler is used or an invalid callback is passed. If the last error handler was a class method, an indexed array with the class and the method name is returned. |
set_exception_handler()
[set_exception_handler – Sets a user-defined exception handler function] |
This function sets the default exception handler if an exception is not caught within a try/catch block. Once the exception_handler is called, execution stops. |
set_exception_handler(exception_handler);
[The method signature of the callable exception_handler prior to PHP 7: handler(exception) . From PHP 7+, the method signature is as follows: handler(throwable) . Providing an explicit Exception -type hint for the callable‘s parameter will cause issues with the changed exception hierarchy in PHP 7. This handler can be reset to its default state by passing NULL as the callable‘s parameter.] |
set_exception_handler() : the name of the previously-defined exception handler is returned on success. NULL is returned on error or if no exception handler was previously-defined. |
trigger_error()
[trigger_error – Generates a user-level error/warning/notice message] |
This function is used to trigger a user error condition. It can be used in conjunction with a user-defined function that has been set as the new error handler using set_error_handler() ; it can also be used with the built-in error handler. trigger_error() is useful when a particular response needs to be generated in response to an exception at runtime. |
trigger_error(error_message, error_type [optional parameter, with a default value of E_USER_NOTICE]);
[error_message is limited to 1024 bytes in length; additional characters will be truncated. HTML entities are not escaped; htmlentities() should be used if the error is to be displayed in a browser. error_type only works with the E_USER family of constants.] |
trigger_error() : returns FALSE if the wrong error_type is specified; TRUE otherwise. |