Specifications

the users name invalid_user. As discussed in Chapter 20, PHP uses a cookie to link ses-
sion variables to particular users. Our script is echoing the pseudo-random number, PHPSESSID,
which is stored in that cookie to identify a particular user.
Error Reporting Levels
PHP allows you to set how fussy it should be with errors. You can modify what types of events
will generate messages. By default, PHP will report all errors other than notices.
The error reporting level is set using a set of predefined constants, shown in Table 23.1.
T
ABLE 23.1 Error Reporting Constants
Value Name Meaning
1 E_ERROR Report fatal errors at runtime
2 E_WARNING Report nonfatal errors at runtime
4 E_PARSE Report parse errors
8 E_NOTICE Report notices, notifications that something you have
done might be an error
16 E_CORE_ERROR Report failures in the start up of the PHP engine
32 E_CORE_WARNING Report nonfatal failures during the start up of the
PHP engine
64 E_COMPILE_ERROR Report errors in compilation
128 E_COMPILE_WARNING Report nonfatal errors in compilation
256 E_USER_ERROR Report user triggered errors
512 E_USER_WARNING Report user triggered warnings
1024 E_USER_NOTICE Report user triggered notices
2048 E_ALL Report all errors and warnings
Each constant represents a type of error that can be reported or ignored. If for instance, you
specify the error level as E_ERROR, only fatal errors will be reported. These constants can be
combined using binary arithmetic, to produce different error levels.
The default error level, report all errors other than notices, is specified as
E_ALL & ~E_NOTICE
This expression consists of two of the predefined constants combined using bitwise arithmetic
operators. The ampersand (&) is the bitwise AND operator and the tilde (~) is the bitwise NOT
operator. This expression can be read as
E_ALL AND NOT E_NOTICE.
Debugging
C
HAPTER 23
23
DEBUGGING
489
29 7842 CH23 3/6/01 3:41 PM Page 489