Home  >  Article  >  Backend Development  >  First introduction to PHP

First introduction to PHP

一个新手
一个新手Original
2017-09-28 10:28:071210browse

1. What is PHP?

PHP Full name PHP: Hypertext Preprocessor, is an open source script language running on the server.

So what is a scripting language? The opposite of a scripting language is not a high-level programming language; it is also a type of programming language. The difference between scripting languages ​​and "non-scripting languages" can be seen as the difference between "analytical languages" and "compiled languages": compiled languages ​​will compile and link the code into executable machine code for the specific platform before running; analytical languages It is compiled and executed line by line until runtime.
2. PHP language structure:

PHP can be divided into a 4-layer system from bottom to top: executable code) and execute them. Note that this is not machine code. Machine code is for the CPU. The opcode here is for the Zend engine. In terms of function, the Zend engine can be compared to the virtual machine in Java.​ ​

​ ② Extensions: Class library and function library, which define various data structures and functions.

③ SAPI: Server Application Programming Interface, obviously this is an intermediate layer used to reduce the coupling between the bottom layer and the upper layer. To put it simply, it is to call various Extensions layer services to encapsulate more powerful services for upper-layer applications to call.

④ Upper-layer application: It is a PHP project written by the user himself.

3. What are the advantages and disadvantages of PHP?

Advantages:

① Simple: The syntax is simple, and complex logic and complex operations are generally not performed in PHP.

② High development efficiency: Many functions commonly used in development have been encapsulated. Some people joke that writing functions is to find "what is the function used by XXX function called" on the Internet.​ ​

​ ③ Free, open source, and can be cross-platform because it is an analytical language.

Disadvantages:

① Low running efficiency: Because PHP is an analytical language, each operation will be more "compiled" than the compilation language.​

② Consequences of supporting weak languages: Uncertain variable types may bring unpredictable results; the engine needs to do a lot of work to support weak types, resulting in reduced efficiency.

The above is the detailed content of First introduction to PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn