It has been almost a year since it became clear that PHP 5.7 had all chances to become PHP 7 – the new stable version of the PHP programming language.

After 8 release candidates and a few release date delays, the new stable player on the PHP ground is now officially out.

This release marks the start of the new major PHP 7.x series, which is a milestone event on the programming horizon.

The story behind PHP 7 in short

When PHP 6 was released back in 2005, it came forward in public space as the logic future descendant of the PHP 5.x series.

By offering an alternative encoding approach where Unicode is brought into the PHP core engine, PHP 6 promised to change the coding landscape for good.

However, that approach could not stand the real-world tests due to the excessive use of CPU and memory resources, which made PHP 6 too complex and resource-consuming to put into practice.

It seemed like the PHP 5.x branch would have to release a candidate to lead the ‘new stable PHP version’ march. It was time to focus on internal optimizations, which gave rise to the experimental PHPNG (also known as PHP 5.7).

It took the best of both worlds by assimilating the most worthy features of PHP 6, among them namespaces support, and the performance and memory utilization improvements initiated in the PHP 5.x series.

This is how PHP 7’s path was paved. Since the development community chose to take the new stable candidate out of the PHP 5.x branch stage, it was a logical step to move straight to PHP 7, skipping PHP 6.

What are the main advantages of PHP 7?

PHP 7’s concept revolves around ‘spaceship-like’ performance characteristics, among them faster speeds and less memory consumption.

Also, it brings new operators and a range of type declarations to the table. Here are the main advantages in detail:

The most striking advantage of upgrading to PHP 7 is the practically doubled real-world performance speeds.

Behind this amazing improvement lies the brand new version of the Zend engine that has been implemented under the code name of PHP#NG.

The refactored Zend Engine offers significantly reduced memory usage and a newly implemented just-in-time compilation (JIT) functionality, which resolves the previous prior-to-execution compilation problems.

On the figure below, you can check the performance benchmark figures provided by the Zend Performance Team and see for yourself:

As you can see, the performance gains realized by PHP 7 vary between 25% and 70% as far as real-world apps are concerned.

You can see the full infographic on PHP 7 performance on the Zend website.

Apart from the doubled speeds, PHP 7 also gives developers the freedom to enhance the quality of their code through accurate return type declarations.

Developers can now prevent unintended return values by declaring what kind of return type a function is expected to have. To enhance the feature even further,

PHP 7 brings in 4 new type declarations for scalar types, allowing developers to denote that they’re expecting strings, floats, ints or booleans to be returned.

The new scalar type declarations are also supported by the existing argument Type Hints.

0 Comments

Leave a reply

your email address will not be published. required fields are marked *