PHP error_get_last() Function

PHP error_log() Function
PHP debug_print_backtrace() Function

In this article, you will learn how to get the last occurred error in PHP. The error_get_last() function returns the last error that occurred. The output is returned as an associative array which contains following four keys.

  • type – Define the type of the error
  • message – Define the error message
  • file – Define the file in which the error occurred
  • line – Define the line where the error occurred

what is the syntax of the ERROR_GET_LAST() function in php?

error_get_last();

examples of the ERROR_GET_LAST() function

Example 1. In this example, we return the last error that occurred.

<?php
echo $test;
print_r(error_get_last());
?>
PHP error_log() Function
PHP debug_print_backtrace() Function
en English
X
Scroll to Top