3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array1 = array(1,2,3,4,5,6,7,8); $originalArray = $array1; $array2 = array('a','b','c','d','e','f','g'); $n = count($array1); for($x = 0; $x < $n; $x++) { array_splice($array1, 1, $x, $array2); print_r ($array1); $array1 = $originalArray; }
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
Array ( [0] => 1 [1] => a [2] => b [3] => c [4] => d [5] => e [6] => f [7] => g [8] => 2 [9] => 3 [10] => 4 [11] => 5 [12] => 6 [13] => 7 [14] => 8 ) Array ( [0] => 1 [1] => a [2] => b [3] => c [4] => d [5] => e [6] => f [7] => g [8] => 3 [9] => 4 [10] => 5 [11] => 6 [12] => 7 [13] => 8 ) Array ( [0] => 1 [1] => a [2] => b [3] => c [4] => d [5] => e [6] => f [7] => g [8] => 4 [9] => 5 [10] => 6 [11] => 7 [12] => 8 ) Array ( [0] => 1 [1] => a [2] => b [3] => c [4] => d [5] => e [6] => f [7] => g [8] => 5 [9] => 6 [10] => 7 [11] => 8 ) Array ( [0] => 1 [1] => a [2] => b [3] => c [4] => d [5] => e [6] => f [7] => g [8] => 6 [9] => 7 [10] => 8 ) Array ( [0] => 1 [1] => a [2] => b [3] => c [4] => d [5] => e [6] => f [7] => g [8] => 7 [9] => 8 ) Array ( [0] => 1 [1] => a [2] => b [3] => c [4] => d [5] => e [6] => f [7] => g [8] => 8 ) Array ( [0] => 1 [1] => a [2] => b [3] => c [4] => d [5] => e [6] => f [7] => g )
Output for hhvm-3.10.0

Process exited with code 153.