Hướng dẫn php 8 type error

PHP supports one error control operator: the at sign [@]. When prepended to an expression in PHP, any diagnostic error that might be generated by that expression will be suppressed.

If a custom error handler function is set with set_error_handler[], it will still be called even though the diagnostic has been suppressed.

Warning

Prior to PHP 8.0.0, the error_reporting[] called inside the custom error handler always returned 0 if the error was suppressed by the @ operator. As of PHP 8.0.0, it returns the value E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE.

Any error message generated by the expression is available in the "message" element of the array returned by error_get_last[]. The result of that function will change on each error, so it needs to be checked early.

Chủ Đề