error_get_last in PHP

Syntax of error_get_last in PHP

array error_get_last()

Returns an associative array of information about the most recent error that occurred, or NULL if no errors have yet occurred while processing the current script. The following values are included in the array:

type The type of error
message Printable version of the error
file The full path to the file where the error occurred
line The line number within the file where the error occurred

Example of error_get_last in PHP

<?php
echo $a;
print_r(error_get_last());
?>
Array
(
    [type] => 8
    [message] => Undefined variable: a
    [file] => C:\WWW\index.php
    [line] => 2
)

Leave a Comment