PHP supports the spread syntax for variadic functions.
In JavaScript, you can use the spread syntax to do this:
var a = [1, 2]; var b = [...a, 3, 4];
In PHP 7.4 you can now use Spread Operators in array expressions.
$parts = ['apple', 'pear']; $fruits = ['banana', 'orange', ...$parts, 'watermelon']; // ['banana', 'orange', 'apple', 'pear', 'watermelon'];