PHP 7: Improve Page Load and Resource Usage
WordPress has played a 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.
However, big changes are finally in the offing with the arrival of PHP 7, and major WordPress hosts such as HostingHolics are already kicking the tires of the latest release and getting ready to fully support it for their users.
In this Article, 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. T
he 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 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 fewer resources to actually execute code – two factors that are excellent news for WordPress users as shown in the early test results below:
THERE ARE TWO KEY POINTS TO EMPHASIZE HERE:
1. There are backward incompatible changes that plugin and theme developers will have to take into account going forward.
2. WordPress’ own commitment to backward compatibility is as strong as ever – both PHP 7 and previous versions will continue to be supported.
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.
To determine if your site is ready to make the switch to PHP 7, check out the PHP Compatibility Checker Plugin by WordPress.