Php error control operator

Source: Internet
Author: User
PHP supports an error control operator :@. Before placing the expression in a PHP expression, any error information that may be generated by the expression is ignored. If set_error_handler () is used to set a custom PHP to support an error control operator :@. Before placing the expression in a PHP expression, any error information that may be generated by the expression is ignored.

If set_error_handler () is used to set a custom error processing function, it will still be called. However, this error processing function can (and should) call error_reporting (), this function returns 0 if @ is present before an error statement.

If the track_errors feature is activated, any error messages generated by the expression are stored in the variable $ php_errormsg. This variable will be overwritten every time an error occurs, so if you want to use it, you should check it as soon as possible.

 

Note: @ operator is only valid for expressions. A simple rule for beginners is: if you can get a value from somewhere, you can add the @ operator before it. For example, you can place it before variables, functions, include calls, constants, and so on. It cannot be placed before the definition of a function or class, nor can it be used for condition structures such as if and foreach.

Warning

[Email protected] �� [email protected] �� [email protected] �� to suppress error messages, the script will show no evidence of the cause and die there.

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.