array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'function.error-clear-last.php', 1 => 'error_clear_last', ), 'up' => array ( 0 => 'ref.errorfunc.php', 1 => 'Funções para Manuseamento de Erros', ), 'prev' => array ( 0 => 'function.debug-print-backtrace.php', 1 => 'debug_print_backtrace', ), 'next' => array ( 0 => 'function.error-get-last.php', 1 => 'error_get_last', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'pt_BR', 'path' => 'reference/errorfunc/functions/error-clear-last.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 7, PHP 8)
error_clear_last — Limpa o erro mais recente
Esta função não possui parâmetros.
Limpa o erro mais recente, fazendo com que não seja possível recuperá-los com error_get_last().
Exemplo #1 Um exemplo de error_clear_last()
<?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());
?>
O exemplo acima produzirá algo semelhante a:
NULL NULL array(4) { ["type"]=> int(8) ["message"]=> string(21) "Undefined variable: b" ["file"]=> string(9) "%s" ["line"]=> int(6) } NULL