PHP error_reporting () function usage and examples

Source: Internet
Author: User
The error_reporting () function kneels and you give the PHP error which should be reported. This function can set the error_reporting directive at run time.

PHP has many error levels that you can use to set the level at which the script runs. If you do not set an optional parameter, level,error_reporting () returns only the current error reporting level.

Grammar

Error_reporting (level);
Parameters Description
Level

Optional. Specify the new error_reporting level. Can be a bitmask or it can be a named constant.

Note: It is strongly recommended to use a named constant to ensure compatibility with future versions. Because of the addition of the error level and the increase in the range of integer values, a longer integer-based error level does not always match the expected performance.

The available error level constants and their actual meanings are described in predefined constants.

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 error error_reporting (E_error | e_warning | E_parse); Report all error error_reporting (E_all);? >

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.