Current Location: Home> Function Categories> error_reporting

error_reporting

What PHP errors should be reported in the settings
Name:error_reporting
Category:Error handling
Programming Language:php
One-line Description:Specify which error is reported.

Definition and usage

error_reporting() function specifies what kind of PHP errors should be reported.

The error_reporting() function can set the error_reporting directive at runtime.

PHP has many error levels, and using this function you can set the level at which the script is run. If the optional level is not set, error_reporting() will only return the current error reporting level.

Example

Specify different error levels reporting:

 <?php
 // Close the error report
 error_reporting ( 0 ) ;

 // Report a runtime error
 error_reporting ( E_ERROR | E_WARNING | E_PARSE ) ;

 // Report all errors
 error_reporting ( E_ALL ) ;

 // equivalent to error_reporting(E_ALL);
 ini_set ( "error_reporting" , E_ALL ) ;

 // Report all errors except E_NOTICE
 error_reporting ( E_ALL & ~ E_NOTICE ) ;
?> 

grammar

 error_reporting ( level ) ;
parameter describe
level

Optional. Specifies the new error_reporting level. It can be a bitmask or a named constant.

Note: Named constants are strongly recommended to ensure compatibility with future versions. Due to the addition of error levels and the increase in integer value range, longer-term integer-based error levels will not always be consistent with the expected performance.

The available error level constants and their actual meaning are described in predefined constants.

Similar Functions
Popular Articles