error_clear_last

(PHP 7)
Clear the most recent error
void error_clear_last ( void )
Returns:

Clears the most recent errors, making it unable to be retrieved with error_get_last().

Examples:
An error_clear_last() example
1
2
3
4
5
6
7
8
9
10
11
<?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 above example will output something similar to:

NULL
NULL
array(4) {
  ["type"]=>
  int(8)
  ["message"]=>
  string(21) "Undefined variable: b"
  ["file"]=>
  string(9) "%s"
  ["line"]=>
  int(6)
}
NULL
See also:

Error constants -

doc_php
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.