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
PHP: rfc:spread_operator_for_array
October 13, 2018 - PHP has already supported argument unpacking (AKA spread operator) since 5.6.
🌐
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.
Discussions

PHP Spread Syntax in Array Declaration - Stack Overflow
It will be available in PHP 7.4. ... Save this answer. ... Show activity on this post. The spread operator in the arrays RFC has been implemented in PHP 7.4: More on stackoverflow.com
🌐 stackoverflow.com
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 21, 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
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
🌐
FlatCoding
flatcoding.com › home › php spread operator: understand how (…) syntax works
PHP Spread Operator: Understand How (…) Syntax Works - FlatCoding
August 23, 2025 - The PHP spread operator expands arrays into function arguments or other arrays. Click to see examples and learn how it works.
🌐
PHP
php.net › manual › en › migration56.new-features.php
PHP: New features - Manual
A right associative ** operator has been added to support exponentiation, along with a **= shorthand assignment operator.
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);
?>
Find elsewhere
🌐
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.
🌐
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.
🌐
Reddit
reddit.com › r/php › rfc in vote: spread operator in array expression
r/PHP on Reddit: RFC in vote: Spread Operator in Array Expression
April 21, 2019 - JS has an object spread operator that works much the way I'm talking about having it work for arrays in PHP.
🌐
PHP Tutorial
phptutorial.net › home › php tutorial › php spread operator
PHP Spread Operator
April 6, 2025 - PHP uses the three dots (...) to denote the spread operator.
🌐
Uts
epress.lib.uts.edu.au › student-journals › plugins › generic › pdfJsViewer › pdf.js › web › viewer.html
PDF.js viewer
May 14, 2026 - No Spreads Odd Spreads Even Spreads · Document Properties… · Toggle Sidebar · Find · Previous · Next · Presentation Mode Open Print Download Current View · Tools · Zoom Out · Zoom In · Automatic Zoom · Actual Size · Page Fit · Page Width · 50% 75% 100% 125% 150% 200% 300% 400% ...
🌐
InfoQ
infoq.com › articles › php8-arrays-variables-operators
PHP 8 - Arrays, Variables, Operators, Exception Handling and More - InfoQ
February 13, 2023 - PHP 8 supports array unpacking with string keys, introduces a new function to determine if an array is a list, and a stable array sort function. Exception handling adds support for non-capturing catches, and use of the throw statement where only an expression is usable. New features related to variable declarations are explicit octal notation 0o/0O for integer literals, limited $GLOBALS usage, and namespaced names as single tokens. New operators include an improved non-strict string to number comparison, the new null-safe operator, locale-independent float to string cast, and stricter type checks for arithmetic/bitwise operators.
🌐
DEV Community
dev.to › marinamosti › understanding-the-spread-operator-in-javascript-485j
Understanding the Spread Operator in JavaScript - DEV Community
September 23, 2019 - Something important to note is that when making a copy of any object/array using a the spread operator the copy will be shallow. This means that if your object has a child object, that child will still have a pointer to the original object.
🌐
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 - On October 9, Juliette Reinders Folmer announced on the core WordPress blog that WordPress 5.3 will use the spread operator. The spread operator was one of the new features made available in PHP 5.6, a version released in 2014.
🌐
Externals
externals.io › message › 112378
Suggestion: Inconsistency: Allow array spread operator to work on string keys - Externals
December 2, 2020 - Then, with PHP 7.4, the spread operator was also introduced for array literal syntax:
🌐
Medium
medium.com › @jochelle.mendonca › effortlessly-merge-arrays-when-to-use-array-merge-vs-the-splat-operator-4f422baf893b
PHP Array Merge: When to Use array_merge vs. the Spread Operator | Medium
April 5, 2024 - Two popular methods for achieving this are the array_merge function and the spread/splat operator which was introduced in PHP 7.4.
🌐
Johnlinhart
johnlinhart.com › blog › php-splat-operator-for-array-type-hints
PHP splat operator for array type hints | John Linhart
March 26, 2023 - SplatCollection - the collection that checks each array element with the splat operator.
🌐
W3Schools
w3schools.com › howto › howto_js_spread_operator.asp
W3Schools.com
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.