3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $original = array( 'a', 'b', 'c', 'd', 'e' ); $inserted = array( 'x' ); // Not necessarily an array array_splice( $original, 3, 0, $inserted ); var_dump($original);
based on 1qXsT
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0rc3
array(6) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" [3]=> string(1) "x" [4]=> string(1) "d" [5]=> string(1) "e" }