How can you downgrade PHP 7's parameter unpacking to v5.5?

78 Views Asked by At

I need to down port one of my most popular PHP packages from 7.0 to 5.5, and it's been years and years since I wrote PHP 5.5 code and I cannot figure out this bit:

$options = array_merge_recursive(
    $userOptions,
    ...$guzzleAuthOptions
);

Is it even possible? I vaguely remember writing this sort of stuff in PHP 5.5 or earlier, but it was quite uncommon for me to do so.

In case it helps, the full context of the code is https://github.com/phpexpertsinc/RESTSpeaker/blob/master/src/HTTPSpeaker.php#L56

1

There are 1 best solutions below

1
user1597430 On BEST ANSWER

Splat operator (three dots) was introduced in 5.6. You should not downgrade anything.

At the same time, for 5.5 and below you may use call_user_func_array.