The spread operator in the arrays RFC has been implemented in PHP 7.4:
$ary = [3, 4, 5];
return [1, 2, ...$ary]; // same as [1, 2, 3, 4, 5]
Caveat: The unpacked array/Traversable can only have integer keys. For string keys array_merge()
is still required.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…