Software

PHP 7.1 Released

PHP (PHP: Hypertext Preprocessor) Logo
PHP (PHP: Hypertext Preprocessor) Logo

PHP version 7.1 was released with a few new features and corrections. Nothing massive (like the major performance increase of version 7) was added so don’t expect hosts to make any major steps to support it.

Nullable Types

Function & method return types can have a question mark (?) placed in front of it to identify that the return value can be either what was identified or a null value. If something other than those values are returned an error is issued.

Void Return Type

Identifying a void return value will only allow nothing to be returned from the function or method. Any other type returned will issue an error.

Iterable Pseudo-Type

A new function or method argument type (or return type) identifier of “iterable” requires an array or object that implements the Traversable interface. If a variable that is not of those types is passed to the function or method an error is issued.

Class Constant Visibility

Class constants can not have a public, private, or protected identifier just like properties.

Square Bracket Syntax for list()

Short-form array syntax can now be used intead of the list() function.

Catch Multiple Exception Type

Similar to if/elseif/else syntax can be used in try/catch blocks to catch more than one type of exception.

Asynchronous Signal Handling

While this cannot be used directly within PHP, certain behind-the-scenes code is being replaced to use asynchronous signals instead of ticks. This will likely a first step to asynchronous process handling in later versions of PHP.

Closure From Callable Function

Callables will be converted to closures automatically when necessary.

HTTP/2 Server Push Support in cURL

A few other smaller features and a number of fixes were also included.

Leave a Comment