3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array( 'a','b','c','d','e','f' ); $b = array( 'x', 'z', 'y' ); function arrayInsertAfter(&$array, $position, $insert) { return $array = array_merge(array_slice($array, 0, $position), $insert, array_slice($array, $position)); } print_r(arrayInsertAfter($a, 2, $b));
Output for 4.3.0 - 7.1.0
Array ( [0] => a [1] => b [2] => x [3] => z [4] => y [5] => c [6] => d [7] => e [8] => f )