3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arrData = array ( array( 'a' => 'test', 'c' => 1, 'd' => 2, 'e' => 'B' ), array( 'c' => 1, 'd' => 2, 'e' => 'B' ), array( 'b' => 'test2', 'c' => 1, 'd' => 2, 'e' => 'B' ) ); $out = array(); foreach ($arrData as $arr) { $out = array_merge($out, $arr); } print_r($out); $out = array_reduce($arrData, function ($c, $v) { return array_merge($c, $v); }, array()); ksort($out); print_r($out);
Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
Array ( [a] => test [c] => 1 [d] => 2 [e] => B [b] => test2 ) Array ( [a] => test [b] => test2 [c] => 1 [d] => 2 [e] => B )

preferences:
107.08 ms | 408 KiB | 5 Q