These new features in PHP 7 will convince you to do an upgrade

There have been some significant improvements to the PHP language. In this article we show you how to take advantage of them, and potentially convince you to do an upgrade and migrate to the new version.

A number of improvements to PHP tooling and infrastructure were announced at the ZendCon 2015 Conference in Las Vegas. These promise significantly better performance, easier development, and better debugging. This is significant since PHP tends to dominate Web development, and many of the most popular wide variety of Web applications are built on PHP including Magento, Drupal, WordPress, and Marketo, said Stu Schmidt, President of Zend Technologies, which was recently acquired by Rogue Wave Software.

Zend engineers have achieved performance gains ranging from 25% to 70% on real-world apps from simply upgrading PHP, without having to change a single line of code.

Andi Gutmans, Rogue Wave executive VP

The PHP specification skipped a generation from PHP 5.6 to PHP 7. The PHP 7 specification is rooted in an experimental branch called PHPNG. This is an alternative to Facebook’s HHVM, a strong contender that also provided performance boosts over PHP 5.6 “But in the end, the PHPNG won out for compatibility and performance reasons,” said Schmidt.  Specific benchmarks comparing the new platform to older versions of PHP and HHVM have been published.

Blazing speed and performance enhancements

The biggest announcement were several optimizations to the fundamental Zend Engine for executing PHP applications that enables performance boosts to most existing PHP applications. Andi Gutmans, Rogue Wave executive VP, strategic partnerships and Zend co-founder said, “Zend engineers have achieved performance gains ranging from 25% to 70% on real-world apps from simply upgrading PHP, without having to change a single line of code.”

There are also new tools for optimizing and refactoring existing code to work with the new engine. The technology preview of Zend Server 8.5  adds support for PHP 7 and makes it easy to migrate applications to experience the improved performance. Zend Studio 13 includes an express migration assistant that helps audit existing code to determine what needs to be fixed to run on PHP 7. It looks for compatibility issues such as reserved words and deprecated usages in PHP 7 and displays issues to be addressed. It also makes it easy to open the corresponding file and line in the project that needs updating.

Another big improvement has been the release of the Expressive development tool that makes it easier to write PSR-7 compatible middleware more easily. It includes support for dynamic routing, DI, templating, and error handling. This makes it easier to leverage componentization by providing developers a choice of 3rd-party components during initial setup for things like request-based routing, dependency injection containers, and templating. Expressive also includes a plug-in architecture for adding new components.

The Z-Ray debugging tool has also been improved to work in a standalone mode. Z-Ray makes it easy to look under the covers to identify resource hogs during the development process and after release. It runs on top of the browser so that a developer can look at the resource utilization of specific elements being rendered on the screen. Z-Ray provides critical information on blocks, events, handles, observers, request properties, page requests, performance metrics, database query insight, and session data.  A new tool called Z-Ray Live! makes it easier to analyze requests originating from mobile clients.

New partnerships with Google and Oracle will make it easier to spin up PHP servers on both these platforms. Google is even offering a $300 credit for the first 60-days for new developers. These cloud implementations of the Zend Frameworks complement existing offerings on the AWS and Azure clouds.

Have you successfully upgraded to the latest version of PHP? Let us know what you think.

Dig Deeper on Core Java APIs and programming techniques

App Architecture
Software Quality
Cloud Computing