Home  >  Article  >  Backend Development  >  Is php considered cross-platform?

Is php considered cross-platform?

(*-*)浩
(*-*)浩Original
2019-09-17 14:21:123534browse

The cross-platform concept is an important concept in software development, which does not depend on the operating system or the hardware environment.

Is php considered cross-platform?

An application developed under one operating system can still run under another operating system. Relatively speaking, if a certain computer language can be highly cross-platform without modifying the code, then the language will be more abstract and the hardware control will be lower, and it will only be suitable for developing highly abstract model systems. (Recommended learning: PHP programming from entry to proficiency)

Such as java and php, they are all cross-platform. They will be able to be developed, run and maintained under a variety of systems.

php is an interpreted scripting language.

So if a PHP program needs to be run, the PHP interpreter first needs to read the PHP program file, and then parse and execute it. Therefore, PHP programming is oriented to the PHP interpreter, and Not a platform.

Each platform has a corresponding php interpreter version, so as long as the php code meets the corresponding interpreter, it can run, and it seems to achieve cross-platform operation

PHP's cross-platform refers to compiling the binary code (PHP interpreter) of the target platform for different platforms.

is a native cross-platform. Of course, its library is also written in platform-independent code. Special libraries such as the Com module that supports Win cannot be put into Linux.

This type of cross-platform is the most efficient and laborious way to run and maintain. For example, the same is true for gcc, and the difference with apache is even greater.

Web Server relies heavily on the Socket model. The Socket IO of Linux and Win are quite different, so this cross-platform mode of writing once and compiling everywhere only has the same name in each platform, and the internal binary content is Completely different.

Programs developed by PHP can run on multiple operating systems such as windows, linux, unix, etc. without modification

Supplement: For example, software for windows systems cannot Running on Linux, Linux system software cannot run on Windows.

But the PHP interpreter has multiple versions of multiple operating systems, and I can’t even name them. All interpreters have The PHP program you write can run on your operating system, whether you write it under Windows or Linux

The above is the detailed content of Is php considered cross-platform?. 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