PHP supports embedded HTML. how does one deal with HTML outside the PHP tag in the PHP file? What is the difference between HTML and HTML? PHP provides an error blocker & amp; rsquo; @ & amp; #39;. how does it block error output? When should I... "> <LINKhref =" http://www.php
PHP supports embedded HTML. how does one deal with HTML outside the PHP tag in the PHP file? What is the difference between HTML and HTML?
PHP provides an error blocker '@'. how does it block error output? When should I use it again?
This is a common question raised by some netizens over the past two days. today, I will simply answer this question and read it later.
Php file embedded HTML processing method
In PHP, all characters outside the tag are translated into T_INLINE_HTML tokens during lexical analysis. during syntax analysis, all T_INLIE_HTML characters are allocated with ZEND_ECHO output.
That is to say:
-
- While ($ con ){
- ?>
- Laruence
- }
- ?>
An OPLINE: T_ECHO will be generated, and the operand is "laruence ";
The above code is actually the same as the following:
-
- While ($ con ){
- Echo "laruence ";
- }
- ?>
However, note that all characters outside the PHP tag are segmented in units of 400 characters during lexical analysis. for example:
-
- If (1 ){
- ?>
- Laruence large numbers of large numbers laruence
- }
- ?>
In the above code, the tag contains 531 characters (including space and carriage return) and is divided into two T_INLINE_HTML outputs.
Error blocker
We know that in PHP, the error message can be silent through the error blocker. how does it work?
During syntax analysis,:
-
- @ Include ('file ');
- ?>
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 the error output.
2. restore the previously saved error_reporting value.
That is to say, the above code is similar to the following code:
- $ Old = error_reporting (0 );
- Include ('file ');
- Error_reporting ($ old );
In addition, let's talk about the question: "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.