We all know the PHP script execution process, first by the Zend engine to compile the PHP source code into a opcode sequence, and then by the Zend VM to explain the execution. The general compilation process is the first lexical analysis, syntax analysis, and then the compilation. After parsing, there is the concept of an abstract syntax tree (abstractsyntax tree or abbreviated AST), which is the output of the parsing, and then the compiler is based on the AST.
But PHP is special, the Zend engine produces opcode directly after parsing, without generating an AST. The greatest benefit of this is to speed up the compilation process, and the downside is the loss of some freedom, the difficulty of optimization, and the complexity of compiling the program logic. There is a wiki on the specific PHP website that explores the introduction of AST in the process of compiling PHP, which is certainly quite difficult to achieve.
We usually do not have access to the PHP compilation process, but AST is a useful thing, we usually work in a lot of tools have AST, such as Php_codesniffer, Php_depend, Zendstudio, PDT, need to analyze the source of the occasion , more or less need AST's help.
Let's look at the PHP7 and PHP5 compilation process,
The above describes the PHP parsing process, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.