Error_reporting () error levels

Source: Internet
Author: User
During PHP Development, error_reporting (report_level) is often used to debug your program. The possible values of report_level are listed below.

During PHP Development, error_reporting (report_level) is often used to debug your program. The possible values of report_level are listed below.

Value Constant Description
1 E_ERROR This is a serious error and cannot be recovered, such as a location exception or insufficient memory.
2 E_WARNING Warning: The most common error, such as a function Parameter error.
4 E_PARSE Parsing error, generated when parsing the PHP file, and forced PHP to exit before execution
8 E_NOTICE An announcement indicates that some unknown variables may be operated. You can enable the notice during development to ensure that the program is "security notice". in the official system, the notice should be closed.
16 E_CORE_ERROR This internal error is caused by PHP loading expansion failure, and may cause PHP to stop running and exit.
32 E_CORE_WARNING Warning during PHP initialization (non-fatal error)
64 E_COMPILE_ERROR A compilation error occurs during compilation, which causes PHP to exit.
128 E_COMPILE_WARNING The compile warning is used to tell the user some unrecommended syntax information.
256 E_USER_ERROR A user-defined error will lead PHP to exit. it is from PHP itself, but from the script file.
512 E_USER_WARNING The script uses it to notify a failed execution, and PHP also uses E_WARNING to notify
1024 E_USER_NOTICE User-defined announcements are used to indicate possible errors in the script
2048 E_STRICT Code Standardization warning (how to modify to forward compatibility)
4096 E_RECOVERABLE_ERROR Near fatal runtime error. if not captured, it is considered as E_ERROR.
8191 E_ALL All errors except E_STRICT (8191 in PHP6, that is, all errors are included)


Example:

Any number of the above options can be connected with "OR" (OR |), so that all required levels of errors can be reported. For example, the following code disables user-defined errors and warnings, performs some operations, and then restores to the original error level:
 

PHP code
  1. // Disable error reporting
  2. Error_reporting (0 );
  3. // Report running errors
  4. Error_reporting (E_ERROR | E_WARNING | E_PARSE );
  5. // Report all errors
  6. Error_reporting (E_ALL );
  7. Error_reporting (7 );
  8. Set php error detection level
  9. E_ERROR-fatal runtime error (1)
  10. E_WARNING-runtime warning (non-fatal error) (2)
  11. E_PARSE-parsing error during compilation (4)
  12. 1 + 2 + 4 = 7
  13. ?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.