PHP — the programming language behind WordPress, Magento, ExpressionEngine, and thousands of other applications — recently got its first major version bump in years. The move from PHP 4 to PHP 5 happened a decade ago, although the language has seen multiple minor version bumps in the intervening years, culminating in PHP 5.6, which was released last year.
PHP 7 is a major update to the foundations of the language and will impact both WordPress users and developers of WordPress themes and plugins. The WordPress team has been hard at work getting ready for PHP 7. It was officially released on December 3rd, 2015, and that’s when WordPress (and Nexcess) began to officially support PHP 7.
If you’re wondering what happened to PHP 6, it existed for a while as a development project but ran into trouble and was abandoned, although a number of its features were back ported into the 5.X branch. Rather than risk confusion, the developers opted to skip to version 7.
In light of the imminent update, it’s worth taking a look at the likely impact on WordPress users and developers.
WordPress Users And PHP 7
The good news is that for the average WordPress user, there is unlikely to be much to do to get ready for PHP 7. The very good news is that PHP 7 is a lot faster than previous versions of PHP. By a lot faster, I mean two to three times as fast. The underlying Zend Engine, on which PHP runs, has been completely refactored and speed was a priority.
The only negative impact that PHP 7 could conceivably have on users is if developers don’t update their plugins and themes for PHP 7 compatibility, which I’ll discuss in the next section.
WordPress Developers and PHP 7
Developers working in the WordPress ecosystem should be aware that a number of backward incompatible changes were made to WordPress to make it compatible with PHP 7. They include the deprecation and removal of style constructors and the Uniform Variable Syntax. Developers should familiarize themselves with changes that are likely to break plugins and themes. Most of these features have been deprecated for some time, but if your plugins and themes haven’t been updated to account for them, now’s the time to get on top of it.
The list of language changes is extensive, and includes a couple of new operators for comparisons and existence checks, scalar type hints (finally), and anonymous classes. All of which should make PHP more pleasant to work with.
If you need to test plugins and themes against a version of WordPress running on PHP 7, Rasmus Lerdorf — PHP’s original creator — has made a Vagrant image available that’s preconfigured for testing.
All-in-all, the upgrade to PHP 7 is great news — as Nexcess clients are well aware, faster WordPress sites make for a better user experience, with all the benefits to online businesses that entails.Posted in: WordPress