Home > News content

PHP 7 is finally released: the developer will choose PHP 7?

via:博客园     time:2015/12/9 17:31:13     readed:1735

English text:PHP 7 Date Arrived: Will Developers Adopt PHP Release 7?

You can read this article, learn about the five aspects of PHP7.0: PHP7.0 introduction, the main new features, the past few weeks on whether the use of the php7.0's willingness to investigate the results of the survey results, the results of the above analysis, as well as PHP future versions of the.

(a) PHP 7

PHP 7 is the first time in 11 years to release the main version of the PHP, PHP last released the main version is in 2004, was released is 5.0.0 PHP.

With this PHP core development staff has long been asleep, PHP 6 has been determined to allow PHP to support Unicode string. However, the development of a standstill, PHP 6 plan was canceled in 2010.

Since then, although there are a number of important new features of the PHP version released, such as PHP 5.4, but no one really can be called master version.

Until 2010 Facebook for the HipHop compiler unveiled. The compiler can turn C into PHP code, and then to the local machine code, using C compiler. Although this idea is very good, but also improved the performance of PHP, but not practical, because the local machine code to compile PHP script takes too long.

Then Facebook changed another way, they developed the HHVM (Virtual Machine HipHop), the engine JIT (In Time Just), the PHP code will be converted to the local machine code. This makes the time consumption greatly reduced and the performance has been significantly improved.

Obviously, Facebook is not satisfied with the characteristics of PHP, so in 2014 started the Hack project, which comes from the PHP language has a lot of PHP no features, such as all data types are more stringent type checks, as well as support for built-in asynchronous programming.

Shortly after Dmitry's Stogov Zend released a branch called PHPNG PHP.

(two) the main new features of PHP 7

PHPNG's original intention is to do an investigation, investigate the introduction of engine JIT will be based on the Zend version of the Engine PHP. However, with further research, he found that other improvements can make PHP code run faster.

PHPNG is the basis of PHP 7, called PHPNG is to avoid confusion with the PHP 6 was canceled.

Other features of PHP7 include: the strict type of scalar values, the possibility of anonymous classes, nested classes, and the possibility of compiling PHP engines as well as specific programs, such as the use of Guided Optimizations Performance (PGO).

PHP 7 was originally planned to be released in October, but has been delayed until December because of some serious bug.

(three) analysis of the results of the survey of PHP7 acceptance

The release of PHP 7 is one of the most exciting things in the world of PHP in recent years because it has too many expectations, such as those mentioned above.

Many developers can't wait to use PHP7, but not everyone can use it correctly. Next this investigation is to evaluate whether PHP programmers are willing to use PHP 7.

Investigation mainly around three questions:

  1. Are you going to use PHP 7 in your production?
  2. Are you going to use PHP 7 in your development environment?
  3. What is the latest version of PHP used in your production?

526 developers to participate in the survey, so the following results should be able to represent the real response of many PHP programmers:

1 do you intend to use PHP 7 in your production?

Yes, I started using the first stable version of 7.0.0.

21

4

Yes, I intend to use the official version of the 7.0.0 release.

One hundred and four

Nineteen point eight

Yes, I will use the official post for a few weeks.

196

Thirty-seven point three

Not necessarily, depending on my client.

44

Eight point four

No, it won't be used very quickly, because it takes too much time to migrate code.

58

11

No, I'm just going to use the project in the future.

64

Twelve point two

No, unless the My Company forced me to use, and no longer provide the old version.

20

Three point eight

Other

19

Three point six

2 do you plan to use PHP 7 in your development environment?

Yes, I've been using it.

41

Seven point eight

Yes, in order to test its new features, I tried several times.

Sixty

Eleven point four

Yes, as long as the official version of 7.0.0 released I will start to use.

218

Forty-one point four

Yes, I'll wait a few weeks to a few months, until I have more time to check it

112

Twenty-one point three

It depends on my client.

11

Two point one

No, I'm not using it now. I'm planning to use it in future projects.

62

Eleven point eight

No, unless the My Company forces me to use it, and I need to change my code

13

Two point five

Other

9

Two point seven

3 what is the latest version of PHP that you use in your production?

PHP 7

10

One point nine

PHP 5.6

299

Fifty-six point eight

PHP 5.5

111

Twenty-one point one

PHP 5.4

59

Eleven point two

PHP 5.3

38

Seven point two

PHP 5.2

5

1

PHP 5.1

Zero

0

PHP 5

1

Zero point two

PHP 4

0

Zero

Other

3

Zero point six

(four) analysis of the results of PHP 7

From the first question can be seen that the vast majority of programmers are not early adopters. They want to use PHP 7 but it takes a while to wait for the PHP7 to be stable after it is used.

Although there are 8 candidates, and the PHP test team to evaluate the possibility of PHP through all the test, but the developers also know that some of the bug and backward incompatible changes exist, these will lead to programmers to spend a long time for the PHP's most final fix or developers need to modify the code.

In addition, there are a part of the programmers who want to use PHP 7 in the new project, because these projects are currently being carried out is very important, so it is not possible to be PHP7 error.

The second question is about how PHP programmers have a curiosity about PHP 7. The results show that most programmers are willing to test PHP 7 in the development environment, because this is more secure.

Programmers have been able to imagine how amazing the amount of work they have to be able to imagine once their code is waiting for them to repair, especially those who own a test suite, because they may have seen a lot of tests that failed.

The third one is the last question, which shows how new PHP versions are being used by programmers.

There is a small part of the people who are brave to use PHP 7 in production. Although I think they are unlikely to be developed using PHP 7 in a very important project.

Data show good news, the vast majority of programmers have started using PHP 5.6. And they are still using PHP 5.3 in the worst case scenario. This may be because their company does not provide other versions, or because the new version does not apply to their code.

Today, almost everyone uses a version that is not less than 5.3.11 PHP, because the older version of the bug, which may cause your server crash.

Maybe you're curious about the 3 choices.

(five) the future of PHP 7

Now that PHP 7 has been officially released, you may be wondering what the next step is. Here are some of the features that have been in the program and the properties we suspect.

Some of the new features of the program we have been in

1 PCO is encrypted PDO

We already know that there is an abstract extension, called PCO, which is similar to PDO but has a password.

2 PHP static code analyzer

Lerdorf Rasmus also developed a tool called PHAN, which is a PHP static code analyzer. The aim is to detect the possible presence of bug by analyzing your PHP code instead of running the code. The tool uses a new AST (abstract syntax tree) extension in PHP 7.

3 asynchronous programming with and await Async

Another possibility is that PHP uses and await async to provide better built-in asynchronous programming support. This allows you to run multiple concurrent tasks in the same script without the need to perform a task.

Please do not mix the asynchronous programming with multi thread programming. PHP has been able to use the extension. pthreads to implement multithreaded programming.

And await Async the biggest advantage is no longer need you to deal with hell callback. This means that if you need to wait for some asynchronous operations, such as access to file systems, databases, or remote servers, you just use the wait key, then the script will continue to operate after the completion of the asynchronous operation.

And await Async constructs the keyword to require PHP to have a number of important changes, because it needs to deal with the internal event loop. However, PHP developers have begun to discuss the implementation of and await async as well as the construction of key words, because these keywords should be saved before other developers use.

In addition, Hack Facebook language is also supported by and await async. I guess Facebook is trying to bring the and await async PHP to PHP.

Maybe you suspect that PHP needs the necessary of the construction, but once you understand their advantages, you will know their importance.

Many programmers transfer to Node.js, because Node.js supports asynchronous programming. Node.js is currently not supported by and await async keyword, but it is only a matter of time, because and await async is one of the new features of EcmaScript 7, and the future of Node.js will be based on EcmaScript 7 JavaScript.

Such development is considered more important. In particular, the recent WordPress announced that it will be possible to cut JavaScript, including the server side of the Node.js and React framework.

Obviously this is one of the biggest steps in their use of the server that is hosted by blogs Wordpress.com. I don't know whether the WordPress community will accept this project because there are thousands of plug-ins that rely on PHP.

4 independent Web server

PHP has an independent Web server, but it is not recommended for the production environment.

Once PHP supports built-in asynchronous programming, it will be easier to use it to develop a Web HTTP service, even if it is written in pure PHP, as in Node.js.

This makes the functionality of the PHP more flexible, more efficient use of parallel requests to use less memory, especially in combination with asynchronous programming and pthreads based multi-threaded programming.

(six) summary

PHP 7 is a huge leap, but the world is constantly spinning, so PHP must keep up with the new trend, such as those mentioned above.

We still want to congratulate the developers on all the time and effort, because they make PHP so good, such as PHP 7.

If you like this article, or want to ask some questions about the new features of PHP 7 and harvest a reply, please comment below.

The translator / reviser Wang Weiqi / Lin Yang / commissioning editor Zhong Hao

Introduction to the translator:Wang Weiqi, master's degree in data mining and information security, Hong Kong Baptist University.

China IT News APP

Download China IT News APP

Please rate this news

The average score will be displayed after you score.

Post comment

Do not see clearly? Click for a new code.

User comments