Main image of article Should You Use PHP 7?
PHP 7.1 was released at the end of 2016, a year after the unveiling of PHP 7.0. (The programming language, used largely in web development, is over 20 years old—ancient, by tech-world standards.) Yet according to some sources, adoption of PHP 7.0 has been fairly modest, despite its status as a major release. That slow uptake aside, PHP 7.0 is much better than previous iterations at type handling, specifying types for function returns, and error handling. There are also notable improvements in the comparison operator (the spaceship operator <=>) as well as the null coalesce (as in C#) that provides a non-null default. Add to this zero-cost assertions (expectations), integer divisions (intdiv(n,d) ), and cryptographically-secure random numbers, and you have a language robust enough to handle a variety of tasks.

PHP 7 Uptake

According to W3Techs, PHP powers 82.6 percent of server-scripted websites; less than 5 percent of those PHP-powered websites, however, use PHP 7—the rest rely on a combination of PHP 4 and 5 (note that PHP 6 was never released due to an unsuccessful attempt to add Unicode; it ended up with such a bad reputation that the developers chose “7” as the number of the next release). Why the slow uptake? There are a few possible reasons.

PHP’s Backwards-Incompatible Changes

The official PHP website features a long page that breaks down the backward incompatibilities between PHP 5.6 and PHP 7. That’s in addition to the list of deprecated features in PHP 7.0.x, which could make it difficult for some developers to upgrade to the latest version of PHP. And remember, breaking a vital client’s website could easily put a development firm out of business. For example, if your website uses the MySQL extension and functions that start with MySQL_, you are in trouble: that’s not built into PHP 7.0, and was deprecated from PHP 5.5 onwards. (You can still use it in 5.5 and 5.6, but shouldn't.) Hosting companies spotted PHP’s depreciation and versioning issues a few years back, and many shifted responsibility to website owners by providing a selectable range of PHP versions (for example, GoDaddy gives you three choices—5.4, 5.5, and 5.6—with no PHP 7 available yet). A few may have caveats in their contracts that reflect this, i.e., “If you change your version of PHP and your website breaks, it’s your problem.” If you work with PHP, it might be worth taking another look at your paperwork to make sure. So if developers aren’t switching to PHP 7.0.x in massive numbers because they’re afraid that doing so will wreck their existing work, what can they do?

A Brief Aside: Open-Source Installers

A quick side-note here for open-source developers: there are commercial third-party installers for open-source packages in PHP, which in turn are licensed to hosting companies. These include Installatron, Fantastico and Softaculous. They add value by allowing the user to install any of over 200 open-source packages, saving an immense amount of labor and time. The convenience of being able to quickly add (and remove) packages from your website makes trying any of these a joy. But here, PHP 7 raises its head again: it will take time for all of these packages to become fully compliant. For example, Installatron has said it doesn't support PHP 7.0/7.1 yet; it may take some time for others like Fantastico to do so, as well.

Caution

Technically, PHP 7 was a significant release; the added speed is certainly helpful. Consider that, with PHP 5.6 on shared hosting, I've timed a simple PHP web page at 100 microseconds; PHP 7 might chop that time in half. This acceleration will help more complex PHP sites, even when you take into account the added time that the browser needs to fetch page components such as jQuery and CSS. For its part, WordPress suggests that switching to PHP 7 (something it recommends, although the platform will still run on earlier PHP versions) will yield a speed increase of up to 70 percent, which in turn will help improve your Google search results (which value faster page-load times). Given how many websites depend on it, PHP is a vital language for many developers to know. However, those tech pros running older websites may want to use some caution before upgrading to PHP 7; although this latest version offers some great benefits, there are also some compatibility issues. That’s not to say you shouldn’t upgrade; but prepare for potentially a lot of work if you do.