|
|
Tutorials » Php »
|
Topic |
What are the different error levels supported in php?
or
What is the use of error levels?
|
|
Explanation |
There are error levels in php with the help of which we can specify the type of error messages
that should be displayed. Say we want only warning messages or compile errors to be displayed
we will use the function error_reporting().
Code Used:
e.g:
error_reporting(E_WARNING | E_COMPILE_ERROR);
To use error levels you should know when a type of error will occur. Here we
have given the different message types supported by php.
Different Error Types:
| Name | Bit Value | Note |
| E_ERROR | 1 | Fatal Errors that will halt script execution |
| E_WARNING | 2 | Non fatal Runtime Errors. |
| E_PARSE | 4 | Error generated by parser. |
| E_NOTICE | 8 | Run-time notices | |
| E_CORE_ERROR | 16 | Error during PHP's initial startup |
| E_CORE_WARNING | 32 | Warning during PHP's initial startup |
| E_COMPILE_ERROR | 64 | Error generated by zend |
| E_COMPILE_WARNING | 128 | Warning generated by zend |
| E_USER_ERROR | 256 | Error generated by user using trigger_error() function |
| E_USER_WARNING | 512 | Warning generated by user using trigger_error() function |
| E_USER_NOTICE | 1024 | Notice generated by user using trigger_error() function |
| E_ALL | 2047 | Defines all messages except E_STRICT |
| E_STRICT | 2048 | |
A basic user will not bother too much about error levels as he would use either 0 or E_ALL for error_reporting().
Next >> Error mailing or redirecting error messages to file.
|
|
|
|