error_clear_last()
error_clear_last() — Clear the most recent error.
Built-in function of PHP 8.5. The manual lists it as available in PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
Signature
error_clear_last(): void
Parameters
This function takes no parameters.
Return value
Clears the most recent errors, making it unable to be retrieved with error_get_last().
Example
A runnable snippet:
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());
Output:
NULL NULL array(4) { ["type"]=> int(8) ["message"]=> string(21) "Undefined variable: b" ["file"]=> string(9) "%s" ["line"]=> int(6) } NULL
All PHP 8.5 built-in functions
Reference card built from the PHP manual page error_clear_last() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.