Variadic functions and argument unpacking in PHP 5.6

Collecting a variable number of arguments used to mean func_get_args(), which hides the signature from anyone reading the function and from every IDE. 5.6 gives the language a real spread operator in both directions: ... in a parameter list collects, and ... at a call site unpacks.

function total(Money $first, Money ...$rest)
{
    foreach ($rest as $amount) {
        $first = $first->add($amount);
    }

    return $first;
}

$lines = [$a, $b, $c];
total(...$lines);

The variadic parameter can be type-hinted, which func_get_args() could never be, so the wrong argument fails at the call rather than deep inside a loop. Unpacking also replaces call_user_func_array() for the common case, and it is considerably faster because there is no callable to resolve.