error_reporting

(PHP3 , PHP4 )

error_reporting -- set which PHP errors are reported

Description

int error_reporting ([int level])

Sets PHP's error reporting level and returns the old level. The error reporting level is a bitmask of the following values (follow the links for the internal values to get their meanings):

Table 1. error_reporting() bit values

valueinternal name
1 E_ERROR
2 E_WARNING
4 E_PARSE
8 E_NOTICE
16 E_CORE_ERROR
32 E_CORE_WARNING

Example 1. error_reporting() examples


error_reporting(0);
// Turn off all reporting

error_reporting(7);
// E_ERROR, E_WARNING, and E_PARSE
// 1+2+4 = 7, for basic running errors

error_reporting(15);
// E_ERROR, E_WARNING, E_PARSE, and E_NOTICE
// 1+2+4+8 = 15, good for code authoring to report
// uninitialized (possibly mis-spelled) variables

error_reporting(63);
// report all PHP errors, rarely used.