Home >Backend Development >PHP Tutorial >What is the difference between php7 and php5

What is the difference between php7 and php5

青灯夜游
青灯夜游Original
2019-05-07 16:12:1911103browse

It has been a long time since PHP7 was officially released. When it first came out, it was claimed to be several times faster than the old version. The speed and efficiency of various open source frameworks or systems running on PHP7 have increased several times. So what is the difference between php7 and php5? The following article will give you a brief introduction, I hope it will be helpful to you.

What is the difference between php7 and php5

The difference between php7 and php5:

1. Performance improvement: PHP7 has twice the performance than PHP5.0 .

2. Comprehensive and consistent 64-bit support.

3. Many fatal errors in the past are now changed to throwing exceptions.

4. PHP 7.0 has removed some old SAPI (server-side application programming port) and extensions that are no longer supported compared to PHP 5.0.

5. PHP 7.0 has a new null join operator than PHP 5.0.

6. PHP 7.0 adds a new combined comparison operator than PHP 5.0.

7. PHP 7.0 adds a function return type declaration compared to PHP 5.0.

8. PHP 7.0 adds a new scalar type declaration compared to PHP 5.0.

9. PHP 7.0 has a new anonymous class compared to PHP 5.0.

Recommended Manual:PHP7 New Features Manual

##Why is the performance of PHP7 improved compared to PHP5?

1. The variable storage bytes are reduced, the memory usage is reduced, and the variable operation speed is improved.


2. The array structure is improved, and the array elements and hash mapping table are allocated in In the same memory, the memory usage is reduced and the CPU cache hit rate is improved


3. The function calling mechanism is improved. By optimizing the parameter transfer link, some instructions are reduced and the execution efficiency is improved

Recommended related articles: 1.
What are the differences between php7 and php5? Comparison between php5 and php72.
New features from PHP5.5 to PHP7.2 3.
What is the difference between garbage collection in php7 and php5
Related video recommendations:1.
Dugu Jiujian (4)_PHP video tutorial

The above is the detailed content of What is the difference between php7 and php5. 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