1. What is PHP?
PHP Full name Php:hypertext preprocessor is an open-source scripting language that runs on the server.
So what is a scripting language? The antithesis of the scripting language is not a high-level programming language, it is also a programming language. Scripting languages and "non-scripting languages" can be seen as the difference between "analytic language" and "compiled language": A compiled language will link code compilation to executable machine code for a specific platform before it runs, and the parsing language is not compiled by line until run time.
2. PHP Language structure:
PHP from bottom to top can be divided into 4 layers system:
①zend Engine: Responsible for compiling PHP code into opcode (operating code abbreviation: execution code), and execute them. Note that this is not a machine code, machine code is CPU-oriented, the opcode is for the Zend engine, in the function can be Zend engine analogy to do Java virtual machine.
②extensions: Class library, function library, defines a variety of data structures and functions.
③sapi:server application Programming Interface, it is obvious that this is an intermediate layer to reduce the coupling between the bottom and the upper layer. Simply put, a service that calls various extensions layers encapsulates a more powerful service for upper-level application invocation.
④ Upper Application: The user writes the PHP project.
3. What are the advantages and disadvantages of PHP?
Advantages:
① simple: syntax is simple, and PHP generally does not carry out complex logic and complex operations.
② development efficiency: Many of the development of commonly used functions have been packaged well, some people play said to write function is to find "xxx function function called what again".
③ is free, open source, and can be cross-platform because it is an analytic language.
Disadvantages:
① is inefficient: Because PHP is a parsing language, each run will have a more "compile" step than the compiled language.
② supports the consequences of weak language: Uncertain variable types can bring unpredictable results, and the engine needs to do a lot of work to support weak types leading to inefficiencies.
First acquaintance with PHP