In the process of program development and debugging errors, we will always encounter various errors. Some errors will affect the execution of the code, and some will just give a WARNING or NOTICE and will not affect the continuation of the following code. implement.
PHP provides an error control operator @. When it is placed before a PHP expression, any error information that may be generated by the expression is ignored. If you want to control the type of error output, you can use the error_reporting() function to tell the compiler what kind of error should be reported.
int error_reporting ([ int $level ] ): Set what kind of PHP errors should be reported
$level is the error level, return the old [error_reporting] level, or the level parameter is not given Returns the current level.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
The error levels and constants are defined in PHP's predefined constants:
The ones we often encounter in development are E_ERROR, E_WARNING, E_PARSE,E_NOTICE.
For more PHP related knowledge, please visit PHP Tutorial!
The above is the detailed content of About errors encountered in PHP development. For more information, please follow other related articles on the PHP Chinese website!