Blog

PHP 7.1 Available on All Servers

September 9, 2016

We're happy to announce the first release candidate of PHP 7.1 is available on all servers. PHP 7.1 keeps the speed and memory efficiency of PHP 7.0 while adding many great new language features.

Language Enhancements

Nullable types

Types can now be made nullable by using a question mark to prefix a type to denote it as nullable.

Void functions

Functions declared with void as their return type can either not have a return statement or use an empty return statement.

Class constant visibility

There is now support for specifying the visibility of class constants.

iterable pseudo-type

A new pseudo-type (similar to callable) called iterable has been added.

Multi-catch exception handling

Multiple exceptions per catch block may now be specified using the pipe character (|); for example:

try {
    // some code
} catch (FirstException | SecondException $e) {
    // handle first and second exceptions
}
Support for Negative String Offsets

Support for negative string offsets has been added to all string-based built-in functions that accept offsets, as well as to the array dereferencing operator ([]).

See the entire list of new language features.

App Compatibility

Most apps that are compatible with PHP 7.0 will be compatible with PHP 7.1.

One notable backwards incompatible change between PHP 7.0 and PHP 7.1 is that invoking user-defined functions with too few arguments now results in an Error exception rather than an emitted warning.

Learn more about backward incompatible changes in PHP 7.1.

Extension Compatibility

If your apps rely on PECL extensions or third-party PHP extensions, such as ionCube, you'll need to wait for the extension developer to add PHP 7.1 support.

The good news is that most PECL extensions that support PHP 7.0 already support PHP 7.1.

Deprecations

The mcrypt extension has been deprecated but not removed. In PHP 7.2, mcrypt will be moved out of PHP core and into a separate PECL extension. At that time, rather than mcrypt being available by default, you'll need to install the mcrypt PECL extension for PHP 7.2 to make it available to any apps you're running on PHP 7.2 that require mcrypt.

Note: We have seen many incorrect articles stating that mcrypt has been removed from PHP 7.1. Those articles are incorrect due to the authors of those articles not understanding that "deprecated" does not mean "removed."

How to Switch to PHP 7.1

To use PHP 7.1 with one of your apps, go to the app's Settings in ServerPilot and change the Runtime to PHP 7.1 RC.

As always, your servers and apps using PHP 7.1 will automatically receive updates as new PHP 7.1 releases become available. When PHP 7.1.0 is released, all apps using PHP 7.1 RC will automatically begin using PHP 7.1.0.