> Le 26 juil. 2021 à 15:41, Sara Golemon a écrit :
>
> A much more direct and maintainable solution would be to introduce a new
> function that intentionally modifies by reference.
That function already exists, it is `array_push()`:
`$x = array_merge($x, $y);` → `array_push($x, ...$y)`
—Cla
On Sun, Jul 25, 2021 at 4:35 PM David Rodrigues
wrote:
> Anyway, I don't know if this is actually possible, or if the cost-benefit
> would be better than what there is today. But I believe it is a path to be
> thought of.
>
Sadly, no. The function doesn't know where the variable is going to be
s
Hi!
Using array_merge() inside a loop can greatly impact performance. From the
tests I did, doing it in the middle costs 250% more than doing it later:
- Inside: for(...) $x = array_merge($x, $y)
- After: for(...) $x[] = $y; array_merge(... $x)
Even using array_push() doesn't seem like a good al