PHP error_get_last() Function

The error_get_last() function returns the last error that occurred (as an associative array).

The associative array contains four keys:

  • [type] - Describes the error type
  • [message] - Describes the error message
  • [file] - Describes the file where the error occurred
  • [line] - Describes the line where the error occurred
  • Example -

    The above code will output something like this: