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.

Answer from Erald Karakashi on Stack Overflow
🌐
PHP
wiki.php.net › rfc › spread_operator_for_array
Spread Operator in Array Expression
October 13, 2018 - $one = 1; $arr1 = [&$one, 2, 3]; $arr2 = [0, ...$arr1]; var_dump($arr2); /* array(4) { [0]=> int(0) [1]=> &int(1) [2]=> int(2) [3]=> int(3) } */ This change should not break anything. Spread operator should have a better performance than array_merge.
🌐
Tutorialspoint
tutorialspoint.com › php › php_spread_operator.htm
PHP - Spread Operator
PHP recognizes the three dots symbol (...) as the spread operator. The spread operator is also sometimes called the splat operator. This operator was first introduced in PHP version 7.4.
Discussions

RFC in vote: Spread Operator in Array Expression
This would be awesome. Lots of great RFC's going through lately, I'm excited for the future of PHP. More on reddit.com
🌐 r/PHP
22
93
April 22, 2019
function arguments : r/PHPhelp
🌐 r/PHPhelp
PHPDoc and the splat operator
Consider the following, contrived, nonsense code example: /** * @param string $name * @param string $surname */ function concat(...$args){… More on reddit.com
🌐 r/PHPhelp
5
1
August 2, 2019
RFC: Square bracket syntax for array destructuring assignment

Awesome RFC, would love this. After getting comfortable with pattern matching in functional programming languages, I find myself wanting to use constructs like list a lot more often, and using the square bracket syntax makes a ton more sense.

Anyone who finds this ambiguous is probably just not terribly familiar with destructuring in general. It's not that square braces are now being used for both construction and deconstruction of an array, the difference between construction and deconstruction is purely about whether you are left or right of the equals sign.

For example, in Elixir, I can create a tuple like so:

a = {1, 2}

I can also assign b to the second element of that tuple like this:

{_, b} = a

If this gets accepted, I'd love to see it extended in a future RFC to support the ... operator, to make it easy to grab the tail of a list:

[$head, ...$tail] = [1, 2, 3, 4, 5]

// $head == 1;
// $tail == [2, 3, 4, 5];
More on reddit.com
🌐 r/PHP
31
96
April 7, 2016
People also ask

When was the spread operator introduced in PHP?
It was first added in PHP 5.6. Back then, it worked only for unpacking arrays into function arguments. PHP 7.4 extended it to work in array expressions too, so you can now merge arrays like this:
$newArray = [...$array1, ...$array2];
🌐
flatcoding.com
flatcoding.com › home › php spread operator: understand how (…) syntax works
PHP Spread Operator: Understand How (…) Syntax Works - FlatCoding
Can I use the PHP spread operator with objects?
No, you cannot use the spread operator directly with objects. If you try to unpack an object, PHP will throw a fatal error. Only arrays and Traversable objects can be unpacked.
🌐
flatcoding.com
flatcoding.com › home › php spread operator: understand how (…) syntax works
PHP Spread Operator: Understand How (…) Syntax Works - FlatCoding
Can I pass an array to a function using the spread operator in PHP?
Yes. If a function expects multiple arguments, you can pass them using the spread operator. Example:
$names = ['Alice', 'Bob', 'Charlie'];
greet(...$names);
🌐
flatcoding.com
flatcoding.com › home › php spread operator: understand how (…) syntax works
PHP Spread Operator: Understand How (…) Syntax Works - FlatCoding
Top answer
1 of 4
74

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.

2 of 4
18

Update: Spread Operator in Array Expression

Source: https://wiki.php.net/rfc/spread_operator_for_array

Version: 0.2
Date: 2018-10-13
Author: CHU Zhaowei, jhdxr@php.net
Status: Implemented (in PHP 7.4)

An array pair prefixed by will be expanded in places during array definition. Only arrays and objects who implement Traversable can be expanded.

For example:

$parts = ['apple', 'pear'];
$fruits = ['banana', 'orange', ...$parts, 'watermelon'];
// ['banana', 'orange', 'apple', 'pear', 'watermelon'];

It's possible to do the expansion multiple times, and unlike argument unpacking, … can be used anywhere. It's possible to add normal elements before or after the spread operator.

Spread operator works for both array syntax(array()) and short syntax([]).

It's also possible to unpack array returned by a function immediately.

$arr1 = [1, 2, 3];
$arr2 = [...$arr1]; //[1, 2, 3]
$arr3 = [0, ...$arr1]; //[0, 1, 2, 3]
$arr4 = array(...$arr1, ...$arr2, 111); //[1, 2, 3, 1, 2, 3, 111]
$arr5 = [...$arr1, ...$arr1]; //[1, 2, 3, 1, 2, 3]

function getArr() {
  return ['a', 'b'];
}
$arr6 = [...getArr(), 'c']; //['a', 'b', 'c']

$arr7 = [...new ArrayIterator(['a', 'b', 'c'])]; //['a', 'b', 'c']

function arrGen() {
    for($i = 11; $i < 15; $i++) {
        yield $i;
    }
}
$arr8 = [...arrGen()]; //[11, 12, 13, 14]

<---------------End of Update-------------------->

First of all you are referencing the Variadic function with arrays in wrong sense.

You can create your own method for doing this, or you can better use array_merge as suggested by @Mark Baker in comment under your question.

If you still want to use spread operator / ..., you can implement something like this yourself.

<?php
function merge($a, ...$b) {
    return array_merge($a,$b);
}

$a = [1, 2];
$b = [3,4];
print_r( merge($a, ...$b));
?>

But to me, doing it like this is stupidity. Because you still have to use something like array_merge. Even if a language implements this, behind the scene the language is using merge function which contains code for copying all the elements of two arrays into a single array. I wrote this answer just because you asked way of doing this, and elegancy was your demand.

More reasonable example:

<?php
$a = [1,2,3,56,564];
$result = merge($a, 332, 232, 5434, 65);
var_dump($result);
?>
🌐
PHP Tutorial
phptutorial.net › home › php tutorial › php spread operator
PHP Spread Operator - PHP Tutorial
April 6, 2025 - Second, define the $scores array of three integers 1, 2, and 3. Also, spread elements of the $numbers array into the $scores array. As a result, the $score array will contain five numbers 1, 2, 3, 4, and 5. The spread operator performs better than the array_merge() function because it is a language construct and a function call. Additionally, PHP optimizes the performance for constant arrays at compile time.
🌐
FlatCoding
flatcoding.com › home › php spread operator: understand how (…) syntax works
PHP Spread Operator: Understand How (…) Syntax Works - FlatCoding
August 23, 2025 - They often had to loop through the array or use call_user_func_array(). The spread operator in PHP is a feature that allows you to unpack elements of an array or Traversable object into individual values.
🌐
DEV Community
dev.to › dev-alamin › exploring-php-spread-operator-for-arrays-tips-tricks-real-use-cases-89f
Exploring PHP Spread Operator (`...`) for Arrays: Tips, Tricks & Real Use Cases - DEV Community
May 19, 2025 - function createUser($name, $email) { return "$name <$email>"; } $data = ['name' => 'Alamin', 'email' => 'you@example.com']; echo createUser(...$data); // PHP 8+ You can’t use ... with functions expecting a single array argument — like: ... function flatten(array $array): array { $result = []; array_walk_recursive($array, function ($item) use (&$result) { $result[] = $item; }); return $result; } $nested = [['a', 'b'], ['c', ['d', 'e']], 'f']; print_r(flatten($nested)); // Output: ['a', 'b', 'c', 'd', 'e', 'f'] The spread operator in PHP is more than syntactic sugar — it brings expressive power to your array operations, simplifies argument handling, and makes your code easier to read.
Find elsewhere
🌐
PHP.Watch
php.watch › versions › 8.1 › spread-operator-string-array-keys
Array unpacking support for string-keyed arrays - PHP 8.1 • PHP.Watch
Since PHP 7.4, PHP supports array spread operator ( ...) for array unpacking. An array can be unpacked with another array if the array expression is prefixed with the spread operator. This effectively results in an array_merge of all arrays in the expression.
🌐
Itsourcecode
itsourcecode.com › home › php spread operator (with advanced program examples)
PHP Spread Operator (with Advanced Program Examples) (2026)
3 weeks ago - This example shows that you can use PHP’s spread operator on any object that implements the Traversable interface, not just an array.
🌐
DEV Community
dev.to › moneer_fahmy_b838032ddcc1 › how-to-use-the-php-spread-operator-4cfk
How to Use the PHP Spread Operator - DEV Community
December 23, 2024 - The PHP spread operator (...) is used to unpack arrays or traversable objects into individual elements. This means you can take the contents of an array and "spread" them out into another array or as arguments to a function.
🌐
Mark Baker's Blog
markbakeruk.net › 2021 › 10 › 04 › spreading-the-news-an-exploration-of-phps-spread-operator
Spreading the News – An Exploration of PHP’s Spread Operator | Mark Baker's Blog
October 11, 2021 - When we call a function using an array of values and the spread operator like this, PHP unpacks the array into a series of individual arguments that are then passed in through the function call.
🌐
Delft Stack
delftstack.com › home › howto › php › php spread operator
PHP Spread Operator | Delft Stack
September 22, 2022 - The code above will use the spread operator to put the values of array $names into the array $all_names. ... The array_merge() method also performs the same operation, but the spread operator is better because it is a language construct that is always better than methods, and PHP will also optimize the performance for arrays at compile time.
🌐
Laravel News
laravel-news.com › home › spread operator for arrays coming to php 7.4
Spread Operator for Arrays Coming to PHP 7.4 - Laravel News
May 10, 2019 - The RFC vote for spread operator support in Array expressions was overwhelmingly in favor of adding this feature to PHP 7.4. The spread operator support for argument unpacking first existed in PHP 5.6, and this RFC expands on the usage to arrays; both arrays and objects that support Traversable ...
🌐
Medium
medium.com › @HoussemZitoun1 › a-pro-tip-when-using-arrays-in-php-43c0945977b7
A pro tip when using arrays in PHP🐘 | by Houssem Zitoun | Medium
March 2, 2024 - So with the spread operator, we can do such things that are not supported by array_merge: <?phpfunction generator(): iterable { yield [1]; yield [2]; yield [3]; }print_r ([...generator()]); // [1, 2, 3]$array = [ ...$iter1, ...$iter2]// with array_merge we should pass by iterator_to_array $array = \array_merge( \iterator_to_array($iter1), \iterator_to_array($iter2) );
🌐
Phpbackend
phpbackend.com › blog › post › php-7-4-array-spread-operator
PHP 7.4 : Array Spread Operator :: PHP Backend Related discussions at PHPBackend.com
Say, we have an array of odd numbers, we want to merge them with another array of even numbers. We can use spread operator to do this · <?php $odd_numbers = [1, 3, 5, 6, 7, 9]; $even_numbers = [2, 4, 6, 8]; $all_numbers = [0, ... $odd_numbers, ...
🌐
Softwarebhai
softwarebhai.com › blog › php-spread-operator
3.9 PHP Spread Operator: Unpacking Arrays and Function Arguments
PHP - Spread Operator (...)The spread operator (...) in PHP is used to unpack arrays and pass multiple arguments to functions. It simplifies array handling and function calls by spreading elements from an array into individual arguments.The ...
🌐
Max Scripting
maxscripting.com › home › php spread operator tutorial with examples
PHP Spread Operator Tutorial with Examples
October 18, 2024 - The spread operator in PHP is a powerful tool for unpacking arrays or traversable objects and passing their elements to functions or merging arrays.
🌐
HashBangCode
hashbangcode.com › article › splat-operator-php
The Splat Operator In PHP | #! code
As some of the names suggest, the splat operator can be used to unpack parameters to functions or to combine variables into an array. If you have seen this operator in JavaScript then it is usually called the spread operator and it works in ...
🌐
WP Tavern
wptavern.com › coming-in-wordpress-5-3-what-is-the-php-spread-operator
Coming in WordPress 5.3: What is the PHP Spread Operator? – WP Tavern
October 21, 2019 - With PHP 5.6, you can simply pass in ...$numbers like so: ... Both methods work and will output 162. However, the second method is easier to read and is less prone to typos because it uses fewer characters. For a more practical example, let’s compare a real-world code change in WordPress and how using the spread operator improves the code over other methods.
🌐
CampCodes
campcodes.com › home › php spread operator and splat operator
PHP Spread Operator And Splat Operator | PHP Tutorial
May 15, 2026 - These follow-up areas usually create the best momentum: ... PHP spread operator is a practical PHP concept used to structure logic, transform data, or make application code easier to read and maintain.
🌐
Laracasts
laracasts.com › series › whats-new-in-php-74 › episodes › 3
Spread Operator Within Arrays
April 29, 2020 - Discover how PHP 7.4 lets you use the spread operator (...) within arrays to write cleaner, more concise code. Learn practical tips and examples in this lesson.