> I have the feeling I'm missing something, but how would this compare to
array join
Array join does neither append nor replace if a numeric index already exists.
But you can do [...$arr0, ...$arr1].
https://3v4l.org/CIinR
print json_encode([
[...['a', 'b'], ...['c', 'd']], // [a, b, c, d]
array_merge(['a', 'b'], ['c', 'd']), // [a, b, c, d]
['a', 'b'] + ['c', 'd'], // [a, b]
array_replace(['a', 'b'], ['c', 'd']), // [c, d]
]);
(I wish we could use yaml for these outputs)
> $arr[...] = $arr2;
Using spread in the array index would be different from current usage
of the spread operator.
But it could be a nice alternative to `$arr = [...$arr, $arr2]`, as it
does not require to repeat the first variable.
So I am not against it.
--- Andreas
On Thu, 6 Apr 2023 at 00:36, Juliette Reinders Folmer
<php-internals_nospam@adviesenzo.nl> wrote: