PHP error_get_last () function
Definition and Usage
error_get_last () function to get the error that occurred last.
This function returns an array of error that occurred last. If no error occurs returns NULL.
Error returned array contains four key names and values:
- [Type] - Error type
- [Message] - Error Messages
- [File] - the file where the error occurred
- [Line] - the line where the error occurred
grammar
error_get_last()
Examples
<?php
echo $test;
print_r(error_get_last());
?>
echo $test;
print_r(error_get_last());
?>
The output of the code above is as follows:
Array
(
[type] => 8
[message] => Undefined variable: test
[file] => C:webfoldertest.php
[line] => 2
)
(
[type] => 8
[message] => Undefined variable: test
[file] => C:webfoldertest.php
[line] => 2
)
Complete PHP Error Reference