3v4l.org

run code in 300+ PHP versions simultaneously
<?php $numeric_tests = array( 'test1' => array( '11', '22', '33', '44' ), 'test2' => array( '44', '55', '66', '77' ) ); $assoc_tests = array( 'test1' => array( '11' => '11', '22' => '22', '33' => '33', '44' => '44' ), 'test2' => array( '44' => '44', '55' => '55', '66' => '66', '77' => '77' ) ); $numeric_concat = array(); $numeric_merge = array(); foreach( $numeric_tests as $test ) { $numeric_concat += array_flip( $test ); $numeric_merge = array_merge( $numeric_merge, $test ); } $assoc_concat = array(); $assoc_merge = array(); foreach( $assoc_tests as $test ) { $assoc_concat += $test; $assoc_merge = array_merge( $assoc_merge, $test ); } print_r($numeric_concat); print_r($numeric_merge); print_r($assoc_concat); print_r($assoc_merge);

preferences:
41.82 ms | 402 KiB | 5 Q