# `array_merge()` and `array_merge_recursive()`

> Section in “New and Extended Functionality › Arrays” of the book [PHP 7 Explained](https://php7explained.com/) by Sebastian Bergmann and Stefan Priebsch, published by thePHP.cc. The book covers PHP 7.0 to 7.4 and was last updated in November 2020. HTML version: <https://php7explained.com/new-and-extended-functionality/arrays/array_merge-and-array_merge_recursive/>

`array_merge()` and `array_merge_recursive()` can now also be called without an argument:

``` php
var_dump(array_merge());
var_dump(array_merge_recursive());
```

Executing the code shown above will print the output shown below:

    array(0) {
    }
    array(0) {
    }

When `array_merge()` and `array_merge_recursive()` are called without an argument they return an empty array. This is useful when the spread operator `...` is used as `...$arrays` may be unpacked to an empty list in which case `array_merge(...$arrays)`, for instance, leads to `array_merge()` being called without an argument.

---

Previous: [The array_column() Function](https://php7explained.com/new-and-extended-functionality/arrays/the-array_column-function/index.html.md) | Next: [array_push() and array_unshift()](https://php7explained.com/new-and-extended-functionality/arrays/array_push-and-array_unshift/index.html.md)
