PHP supports spread operator PHP Spread Syntax in Array Declaration
$ary = [3, 4, 5];
return [1, 2, ...$ary]; // same as [1, 2, 3, 4, 5]
Now I am trying a simple spread operator on 'Object' but it is failing
$a = ['a' => 1];
$b = ['b' => 2];
$c = [...$a, ...$b]; // Expected $c = ['a' => 1, 'b' => 2]
Am I missing something?
Cannot unpack array with string keys