error_clear_last — Clear the latest error
error_clear_last() Example
<?php var_dump(error_get_last()); error_clear_last(); var_dump(error_get_last()); @$a = $b; var_dump(error_get_last()); error_clear_last(); var_dump(error_get_last()); ?>
The output of the above routine is similar to:
NULL NULL array(4) { ["type"]=> int(8) ["message"]=> string(21) "Undefined variable: b" ["file"]=> string(9) "%s" ["line"]=> int(6) } NULL
error_get_last — Get the last error that occurred, it returns an associated array, describing the last error information, with the error's "type", "message", "file" and "line" as the keys of the array . If the error is caused by a PHP built-in function, "message" will start with the function name. Returns NULL if there are no errors yet.
error_get_last() Example
<?php echo $a; print_r(error_get_last()); ?>
The output of the above routine is similar to:
Array ( [type] => 8 [message] => Undefined variable: a [file] => C:\WWW\index.php [line] => 2 )
The above is the detailed content of php error_clear_last() function and error_get_last() function. For more information, please follow other related articles on the PHP Chinese website!