WordPress has played a hugely significant role in helping PHP conquer the web over the last 12 years. While WordPress has whizzed through successive versions at an ever-increasing rate during that time, the language that still powers the majority of the platform has remained incredibly stable behind the scenes.
Big changes are finally in the offing with the arrival of PHP 7, however, and major WordPress hosts such as WP Engine are already kicking the tires of the latest release and getting ready to fully support it for their users.
In this piece, we’ll take a look at the development of PHP 7 to date, what the major changes are, what they mean for WordPress users, and consider whether you should be thinking of making the switch to the new version straight out of the gate.
Let’s tee things up with a brief trip down memory lane.
How PHP Took Over the Web
PHP’s current omnipresence is almost taken for granted these days, but there was very little to suggest that it would go on to dominate the web when it was first cobbled together by Rasmus Lerdorf back in 1994.
In many ways, PHP’s rise to the top has been a triumph of good, old-fashioned elbow grease over abstract programmatic concerns. In contrast to competing solutions such as Java and Perl, the language was straightforward enough to attract an audience new to the web, and simple enough on the server side to quickly become a standard install option at hosts worldwide. Put simply, PHP enabled a generation of coders to just get it done.
Its early adoption by a host of popular CMS offerings sealed the deal, with WordPress being by far the most significant of them. The PHP 5.x series sprang into life in 2004, and if you’re running WordPress today, you’re almost certainly running a minor version of this under the hood as we speak.
The 5.x series has served PHP well over time, but 12 years is a long time between major versions. Sooner or later, a change was bound to come.
PHP 7 Finally Heaves Into View
Before we get into the nitty-gritty of PHP 7, let’s get some potential naming confusion out of the way. The last stable release of PHP was PHP 5.6 in 2014, so at this stage, you might well be wondering what happened to PHP 6.
To cut a long story short, there was a previous attempt at a new major version using the name PHP 6 from 2005 to 2010 that never fully got off the ground, and to avoid muddying the waters, the decision was eventually made to go straight from the 5.x series to PHP 7.
PHP 7 has been under active development since 2014, and was officially released in December 2015. Its development arrived at an interesting time in the wider PHP world, as new initiatives such as Facebook’s HipHop Virtual Machine were simultaneously expanding what was previously thought possible with the language.
Add in the fact that it’s been over a decade since the last major release, and there was understandably a lot of excitement and anticipation leading up to PHP 7 actually landing – and land it duly did!
Let’s step through the main points that have been setting developers’ pulses racing since then:
- It’s a true major release. A major release is effectively a clean slate, and clears the decks for major (potentially breaking) changes. With the amount of cruft that PHP has gathered over the years, this is excellent news for all concerned.
- There’s a brand new engine under the hood. The Zend Engine II has been doing sterling work on the PHP 5.x series over the years, but PHP 7 will be firing on all cylinders thanks to the spanking new PHPNG (Next Generation) engine that powers it.
- A host of powerful new language features are available. The latest version of PHP 7 ships with plenty of new options for developers to explore, including type declarations, space ship operators, and significantly improved error handling. Check out Treehouse’s excellent run-down of the main items for an in-depth overview of the main significant points.
The main appeal of the new version (and the thing that will be of most interest to the average WordPress user) can be summed in one word – speed. Let’s move on to look at it in a bit more depth.
WordPress Is About to Get Wings
Compared to its predecessors, PHP 7 is blazingly fast. The common consensus seems to be that it’s at least twice as fast across the board, and requires substantially less resources to actually execute code – two factors that are excellent news for WordPress users as shown in the early test results below:
Tests from Zend and WP Engine (among many others) have confirmed the significant improvements we can expect in both speed and performance, and the WordPress Core team have been beavering away at getting the platform ready for the new version since mid-2015.
There are two key points to emphasize here:
- There are backwards incompatible changes that plugin and theme developers will have to take into account going forward.
- WordPress’ own commitment to backwards compatibility is as strong as ever – both PHP 7 and previous versions will continue to be supported.
From the average end user point of view, it’s fair to say PHP 7 will be a slow burn in terms of when they really see the advantages.
Anecdotal evidence from around the web suggests there is still a lot of work to be done on popular themes and plugins before many are ready for the new hotness. WP Engine’s own investigations into the general state of PHP 7 readiness also backed that up, as founder Jason Cohen confirmed in the company’s announcement that it is trialling PHP 7 opt-in support later in 2016:
We have PHP 7 running on some machines, but it’s actually amazing how few WP sites in the field are compatible. We’re finding that it’s less than 20%. There will need to be an opt-in for that reason.
Taking a broad view, we can expect end user switchover to PHP 7 to be slow and steady as the core team, hosting partners, and developers continue to work towards offering bulletproof solutions.
Speaking of which, let’s start closing things out by looking at whether developers themselves are ready to pull the trigger yet.
Why Developers Are Holding Fire on Switching (For Now)
Developers are (rightly) a cautious bunch at the best of times, and it seems likely the majority will ease into PHP 7 slowly, rather than charging in all guns blazing. Organic factors – such as PHP 7 gradually becoming the default PHP package shipped with various Linux distributions – will help, but don’t expect a stampede any time soon.
A developer survey by PHP Classes in the run-up to the official release offers a decent snapshot of sentiment across the community. Respondents were asked three straightforward questions:
- Are you going to use PHP 7 in production?
- Are you going to use PHP 7 in your development environment?
- What is the latest PHP version you are using in production?
You can see the full results over on the survey page, but the range of answers broadly shows around half of the respondents actively considering using it in production in the short to medium-term future, and roughly the same amount either already or about to start using it in their development environments:
When you consider the sheer range and variety of things that can go wrong in any development setup, this softly-softly approach makes a lot of sense. That said, a number of larger outfits with the resources to really dive in and explore have already successfully made the switch, with Badoo being the main one to spill the beans so far.
In contrast to previous PHP releases (both major and minor), this one looks to be proceeding smoothly straight out of the gate, and there’s been a refreshing lack of drama associated with it so far.
The WordPress benchmarks that have been run against the latest releases show that genuinely transformative speed and performance increases are very much there to be had. That’s great news for both developers and users as the REST API simultaneously starts to make its presence felt.
All that said, the road to full adoption will be a slow and cautious one, and there’s plenty of work remaining for hosting companies and developers to make sure there are no nasty bumps along the way. The eagle, however, has at least finally landed!
Are you considering making the switch to PHP7, and if so, what is drawing you to it? Share your thoughts with us in the comments section below!
Featured image credit: neico.