X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP error_get_last() Function

PHP Error PHP Error Reference

Example

Return the last error that occurred:

<?php
echo $test;
print_r(error_get_last());
?>

The above code will output something like this:

Array
(
    [type] => 8
    [message] => Undefined variable: test
    [file] => C:\webfolder\test.php
    [line] => 2
)


Definition and Usage

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

Syntax

error_get_last();

Technical Details

Return Value: Returns an associative array describing the last error with keys: type, message, file, and line. Returns NULL if no error has occurred yet
PHP Version: 5.2+


PHP Error PHP Error Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook