The kernel principle of php
The kernel component modules and operating principle of php
Understanding of the three major modules of PHP:
1.PHP core: Its function is to handle (requests, file streams, errors) and other related operations.
2.Zend engine: Convert PHP files into machine language and then run on the virtual machine.
3. Extension layer: functions, class libraries, streams. PHP can load extensions to implement some specific operations.
Recommended: "PHP Tutorial"
The relationship between the three:
Zend needs to connect several extensions when executing the program,
it Transfer the control to the extension layer,
wait for the extension layer to complete processing, and
return the result to Zend.
Finally Zend returns the program running results to the PHP kernel.
The PHP kernel then passes the results to the SAPI layer.
Finally output to the browser.
PHP design philosophy and features:
Multi-process model: Since PHP is a multi-process model, different requests do not interfere with each other, which ensures that the failure of one request will not affect the entire service. , Of course, with the development of the times, PHP has already supported the multi-threading model.
Weakly typed language: Unlike C/C, Java, C# and other languages, PHP is a weakly typed language. The type of a variable is not determined at the beginning. It is determined during operation and implicit or explicit type conversion may occur. The flexibility of this mechanism is very convenient and efficient in web development. The details will be discussed in PHP later. Variables are detailed in.
The engine (Zend) component (ext) mode reduces internal coupling.
The middle layer (sapi) isolates the web server and PHP.
The syntax is simple and flexible, without too many specifications. Disadvantages lead to a mixture of styles.
The above is the detailed content of The core principle of php. For more information, please follow other related articles on the PHP Chinese website!