New PHP release brings another speed boost

Version 7.1.0 of the language also backs nullable types

The PHP 7 line, which debuted a year ago, has received its first point release upgrade, improving performance and featuring nullable types.

Version 7.1.0 also offers capabilities like a void return type and class constant visibility modifiers. But a key PHP advocate stressed performance. The upgrade "[provides] up to 35 percent better performance in CPU-intensive workloads," said Zeev Suraski, CTO at PHP tools producer Zend.

Nullable types in 7.1 allows a check type to be of some type or null. "Type declarations for parameters and return values can now be marked as nullable by prefixing the type name with a question mark. This signifies that as well as the specified type, null can be passed as an argument, or returned as a value, respectively," documentation states.

Version 7.1 also supports class constant visibility to mirror the behavior of method and property visibility. "Class constant may be defined as public, private or protected. class constants declared without any explicit visibility keyword are defined as public," according to the proposal.

A "void" return type in PHP 7.1 makes it clear that a function performs an action rather than producing a result. An iterable pseudo-type, meanwhile, can be used as a parameter type to indicate that a function requires a set of values while not caring about the form of the value set. "This type is analogous to callable, accepting multiple types instead of one single type," documentation states.

PHP 7.2 is slated to introduce an Argon2 password hash. "Argon2 addresses several key downsides of existing algorithms in that it is designed for the highest memory filling rate, and effective use multiple computing units while still providing defense against tradeoff attacks," the documentation states.

Join the Computerworld newsletter!

Error: Please check your email address.

More about AgileClass

Show Comments

Market Place