@ Suppress exception operators in php

Source: Internet
Author: User
In php, a friend of the @ suppression error operator asked me today about the @ suppression error operator of PHP. I found that it is rarely used. I have reviewed it. note: @ suppression error operator in php:
Today, a friend asked PHP @ to suppress the error operator and found that it is rarely used. let's take a look at it:


Http://www.laruence.com/2009/07/27/1020.html
Error blocker
We know that in PHP, the error message can be silent through the error blocker. how does it work?

During syntax analysis,:

Two Opline (operations) will be inserted before and after the include statement respectively. These two operations are done respectively:

1. save the current error_reporting value and set error_reporting (0); // disable error output 2. restore the previously saved error_reporting value, that is, the above code is similar to the following code:

$ Old = error_reporting (0); include ('file'); error_reporting ($ old); also, let's say: "When Will error suppression be applied ?", My personal suggestion is that if an error in this statement does not affect you much and you do not care about the error, you will not arrange additional logic to handle the error, then you can use error suppression. otherwise, use additional logic to identify errors.

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.