1<?php
2
3$notFlat = [[1,2],[3,4]];
4$flat = array_merge(...$notFlat);
5var_dump($flat);
6
1$c = ["a" => ["x" => "X", "y" => "Y"], "b" => ["p" => "P", "q" => "Q"]];
2print_r(array_merge(...array_values($c)));
3
4Array
5(
6 [x] => X
7 [y] => Y
8 [p] => P
9 [q] => Q
10)
11
1$a = [[10, 20], [30, 40]];
2$b = [["x" => "X", "y" => "Y"], ["p" => "P", "q" => "Q"]];
3
4print_r(array_merge(...$a));
5print_r(array_merge(...$b));
6
7Array
8(
9 [0] => 10
10 [1] => 20
11 [2] => 30
12 [3] => 40
13)
14Array
15(
16 [x] => X
17 [y] => Y
18 [p] => P
19 [q] => Q
20)
21