Is Php an interpreted programming language?

(*-*)浩
Release: 2023-02-24 10:54:01
Original
4110 people have browsed it

Compiled language and interpreted language

Is Php an interpreted programming language?

##1. Compiled language

A language that requires a compiler to compile the source code into machine code before it can be executed. Generally, it needs to go through two steps: compile and linker.

Compilation is to compile the source code into machine code, and linking is to concatenate the machine code of each module and the dependent library to generate an executable file. (Recommended learning:

PHP programming from entry to proficiency)

Advantages: Compilers generally have a pre-compilation process to optimize the code. Because compilation is only done once and does not require compilation at runtime, compiled language programs have high execution efficiency. Can run independently of the locale.

Disadvantage: If you need to modify it after compilation, you need to recompile the entire module. When compiling, machine code is generated according to the corresponding operating environment. There will be problems when transplanting between different operating systems. Different executable files need to be compiled according to the running operating system environment.

Represents languages: C, C, Pascal, Object-C and the recently popular Apple new language swift

2, interpreted language

Interpreted language programs do not need to be compiled. Compared with compiled languages, interpretive languages ​​save a step. Interpreted languages ​​only translate line by line when running the program.

Advantages: It has good platform compatibility and can run in any environment, provided that an interpreter (virtual machine) is installed. Flexible, you can modify it directly when modifying the code, and it can be deployed quickly without downtime for maintenance.

Disadvantages: It needs to be explained every time it is run, and the performance is not as good as compiled languages.

Represents languages: JavaScript, Python, Erlang,

PHP, Perl, Ruby

3, mixed language

Since Compiled and interpreted types each have shortcomings, so some people think of integrating the two types, taking the best and discarding the dross. Semi-compiled languages ​​appeared.

For example, C# is not directly compiled into machine code but intermediate code during compilation. The .NET platform provides an intermediate language runtime to run the intermediate code. The intermediate language runtime is similar to the Java virtual machine. After .net is compiled into IL code, it is saved in dll. When it is run for the first time, JIT compiles it into machine code and caches it in the memory, and executes it directly next time.

Java first generates bytecode and then interprets and executes it in the Java virtual machine. Strictly speaking, hybrid languages ​​are interpreted languages. C# is closer to a compiled language.

PHP is an interpreted language:

However, their similarities mainly lie in the underlying underlying format: they are both just text. Instead of opening the html file in a web browser, you can open the html file in Notepad (Notepad program) or an integrated development environment like Eclipse, or in a command line editor like vi or emacs. Likewise, PHP code is also composed of text.

Once you have a script, you have to let the PHP program interpret the script. The PHP interpreter is a software that runs on your web server and can read and understand the content of the script. It outputs the interpreted code to the web server and instructs the server where to jump next, or how to process the user's form. field item.

Remember that your script is just a text file that is only interpreted line by line each time the script is accessed.

The above is the detailed content of Is Php an interpreted programming language?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template