0

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

Theodore R. Smith
  • 21,848
  • 12
  • 65
  • 91
  • [Same question there](https://stackoverflow.com/questions/44684728/php-5-4-17-alternative-for-the-operator) (just in case). – Jeto Aug 22 '20 at 06:20

1 Answers1

1

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.

user1597430
  • 1,138
  • 1
  • 7
  • 14
  • My bad. I'm going to delete the question. Hopefully you still get the credit. Nevermind, stackoverflow won't let me. I'll rephrase the question to 5.5... – Theodore R. Smith Aug 22 '20 at 00:40