New features

Nullable types

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.

Void functions

A void return type has been introduced. Functions declared with
void as their return type must either omit their return statement altogether,
or use an empty return statement. NULL is not a valid return value for a
void function.

A new pseudo-type (similar to callable) called
iterable has been introduced. It may be used in parameter
and return types, where it accepts either arrays or objects that implement
the Traversable interface. With respect to subtyping,
parameter types of child classes may broaden a parent's declaration of array
or Traversable to iterable. With return types,
child classes may narrow a parent's return type of iterable to
array or an object that implements Traversable.

<?phpfunction iterator(iterable $iter){ foreach ($iter as $val) {//}}

Multi catch exception handling

Multiple exceptions per catch block may now be specified using the pipe
character (|). This is useful for when different
exceptions from different class hierarchies are handled the same.

Support for negative string offsets

Support for negative string offsets has been added to the
string manipulation functions
accepting offsets, as well as to
string indexing with
[] or {}. In such cases, a negative
offset is interpreted as being an offset from the end of the string.

<?phpvar_dump("abcdef"[-2]);var_dump(strpos("aabbcc", "b", -3));

The above example will output:

string (1) "e"
int(3)

Negative string and array offsets are now also supported in the simple
variable parsing syntax inside of strings.

<?php$string = 'bar';echo "The last character of '$string' is '$string[-1]'.\n";?>

Asynchronous signal handling

A new function called pcntl_async_signals() has been
introduced to enable asynchronous signal handling without using ticks (which
introduce a lot of overhead).

<?phppcntl_async_signals(true); // turn on async signals

pcntl_signal(SIGHUP, function($sig) { echo "SIGHUP\n";});

posix_kill(posix_getpid(), SIGHUP);

The above example will output:

SIGHUP

HTTP/2 server push support in ext/curl

Support for server push has been added to the CURL extension (requires
version 7.46 and above). This can be leveraged through the
curl_multi_setopt() function with the new
CURLMOPT_PUSHFUNCTION constant. The constants
CURL_PUSH_OK and CURL_PUSH_DENY have also been
added so that the execution of the server push callback can either be
approved or denied.