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, 0, $b));
Output for 4.3.0 - 7.1.0
Array ( [0] => x [1] => z [2] => y [3] => a [4] => b [5] => c [6] => d [7] => e [8] => f )