PHP error handling functions - error_get_last()
Introduction
The error_get_last() function is used to get information about the last error occurred.
Version:
PHP 5
Syntax:
error_get_last (void)
Parameters:
None
Return Values:
Returns an associative array stating the last error.
Keys of the returned array are "type", "message", "file" and "line". If no errors took place, it returns NULL.
Example:
<?php
$_SESSION['website'] = "w3r";session_destroy();// this is for destroying session, but which one?echo $_SESSION['website']."
";print_r(error_get_last());?>
The following code displays this output :
w3r Array( [type] => 2 [message] => session_destroy() [function.session-destroy]: Trying to destroy uninitialized session [file] => C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\php\erro-get-last-example.php [line] => 3)
Previous: debug_print_backtrace()()
Next: error_log()
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics