The error_reporting() function specifies which error to report.
This function sets the error reporting level for the current script.
This function returns the old error reporting level.
error_reporting(report_level)
parameter | describe |
---|---|
report_level | Optional. Specifies the error reporting level for the current script. Both value numbers and constant names are acceptable, however, considering compatibility with future PHP versions, it is recommended to use constant names. |
value | constant | describe |
---|---|---|
1 | E_ERROR | Runtime fatal error. Unfixable errors. Stop executing the script. |
2 | E_WARNING | Non-fatal runtime error. Script execution is not stopped. |
4 | E_PARSE | Compile time parsing error. Parsing errors should only be generated by the parser. |
8 | E_NOTICE | Runtime notifications. Script discovery can be a bug, but can also occur when running a script normally. |
16 | E_CORE_ERROR | Fatal error on PHP startup. This is just like PHP core's E_ERROR. |
32 | E_CORE_WARNING | Non-fatal error when starting PHP. This is just like PHP core's E_WARNING. |
64 | E_COMPILE_ERROR | Fatal compile-time error. This is just like the E_ERROR generated by the Zend scripting engine. |
128 | E_COMPILE_WARNING | Non-fatal compile-time error. This is like an E_WARNING generated by the Zend scripting engine. |
256 | E_USER_ERROR | User-generated fatal error. This is like the E_ERROR generated by the programmer using the PHP function trigger_error(). |
512 | E_USER_WARNING | User-generated non-fatal error. This is like an E_WARNING generated by the programmer using the PHP function trigger_error(). |
1024 | E_USER_NOTICE | User-generated notifications. This is like the E_NOTICE generated by the programmer using the PHP function trigger_error(). |
2048 | E_STRICT | Runtime notifications. PHP recommends that you make changes to your code to improve code interoperability and compatibility. |
4096 | E_RECOVERABLE_ERROR | Catchable fatal errors. This is like an E_ERROR that can be caught by a user-defined handle (see set_error_handler()). |
8191 | E_ALL | All error and warning levels except E_STRICT (since PHP 6.0, E_STRICT will be part of E_ALL). |
<?php//Disable error reportingerror_reporting(0);//Report runtime errorserror_reporting(E_ERROR | E_WARNING | E_PARSE);//Report all errorserror_reporting(E_ALL);?>