PHP Set Error level

Source: Internet
Author: User

Definition and Usage:
Error_reporting () Sets the error level for PHP and returns the current level.

function Syntax:
Error_reporting (Report_level)

If the parameter level is not specified, the current error levels are returned. The following items are possible values for level:
Value constant Description

1E_errora fatal run error.    The error cannot be resumed and execution of the script is paused. 2e_warningRun-time warning (non-fatal error).    Non-fatal run error, script execution does not stop. 4E_parsecompile-time parse error.    Parsing errors are generated only by the parser. 8E_noticeRuntime Reminders (These are often caused by bugs in your code, or by intentional behavior.) )    16E_core_errorfatal error during initialization of PHP at startup. 32e_core_warningwarnings during initialization of PHP startup (non-fatal error). 64E_compile_errorcompile-time fatal error.    This is like a e_error generated by the Zend scripting engine. 128e_compile_warningCompile-time warning (non-fatal error).    This is like a e_warning warning generated by the Zend scripting engine. 256E_user_erroruser-defined error message. It's like using PHP function trigger_error (programmer setup E_error)512e_user_warninguser-defined warning message. This is like using PHP function Trigger_error (a e_warning warning set by the programmer)1024E_user_noticea user-defined reminder message. It's like a trigger_error by using PHP function (programmer a e_notice set)2048e_strictCoding Normalization Warning.    Allows PHP to suggest how to modify the code to ensure the best interoperability forward compatibility. 4096E_recoverable_error to catch a fatal error. This is like a e_error, but can be captured by user-defined processing (see also Set_error_handler ())8191E_allAll errors and warnings (not includinge_strict) (e_strictwould be part ofE_all  asof PHP 6.0)

Example:
Any number of the above options can be connected (with OR or |) using "or" to report all required levels of errors.
For example, the following code turns off user-defined errors and warnings, performs certain actions, and then reverts to the original error level:

    <? PHP     // Disabling error Reporting    error_reporting (0);        // report Run-time errors    error_reporting (e_errore_warninge_parse);        // Report all Errors    error_reporting (e_all);    ? >

A simple example is:

error_reporting (e_errore_warninge_parsee_notice);

He says PHP errors, warnings, grammatical errors, and reminders are all wrong.

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.