PHP Kernel--zend engine ____php

Source: Internet
Author: User
Tags php script sapi zend
In the previous section describes the life cycle of PHP, PHP Sapi,sapi in the entire architecture of PHP, and the implementation of the real script is mainly done by the Zend engine, this section we introduce the implementation of PHP script. The current programming language can be divided into two main categories: The first class is a compiled language like C + +,. NET, Java, which has the common denominator that the source code must be compiled before it runs, and then the compiled target file is run. The second category, such as PHP, Javascript, Ruby, and Python, is that they don't have to be compiled to "run", although they can be understood to run directlyBut they are not really directly understood by the machine, machines can only understand the machine language, and how these languages are executed, generally these languages need an interpreter, by the interpreter to execute the source code, in fact, these languages will still be compiled, but they generally will be in the runtime to compile real-time. For efficiency, not all languages are recompiled every time it executes, such as PHP's various opcode cache extensions (such as APC, XCache, Eaccelerator, etc.), such as Python, which saves the compiled intermediate files as pyc/pyo files. Avoid the performance penalty of recompiling every time you run.
<?php
$str = "Hello, tipi!\n";
echo $str;
? >

PHP script execution also requires an interpreter, such as the PHP program under the command line, or Apache mod_php module, and so on. The previous section mentions PHP's SAPI interface, and the following example explains how PHP scripts are executed in the PHP command-line program. For example, the following PHP script: Suppose the above code is stored in a file named Hello.php, and execute the script with a PHP command-line program:
$ PHP./hello.php


The output of this code is obviously hello, tipi!, so what did Php/zend do when the script was executed? How do these statements get PHP to output this passage? The following is a step-by-step introduction.


namely: Lexical analysis => grammar analysis => opcode (intermediate code) compile =>zend Engineer Execute


PHP's compilation process can refer to Brother Bird's article: a deep understanding of the PHP principles of opcodes:http://www.laruence.com/2008/06/18/221.html








Reference: Deep understanding of PHP Kernel: http://www.php-internals.com/book/
Brother Bird's Blog: http://www.laruence.com/2008/08/14/250.html http://www.laruence.com/2008/06/18/221.html http:// Www.laruence.com/2008/08/12/180.html
Many network information ...

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.