Current Article:

How to flatten a multidimensional array in PHP?

How to flatten a multidimensional array in PHP?

In PHP 5.6 and above you can flatten two dimensional arrays with array_merge after unpacking the outer array with ... operator. The code is simple and clear:

array_merge(...$a);