3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array1 = array(1,2,3,4,5,6,7,8); $array2 = array('a','b','c','d','e','f','g'); $n = count($array1); for($x = 0; $x < $n; $x++) { array_splice($array1, 1,0,$array2); print_r ($array1); }
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] => a [9] => b [10] => c [11] => d [12] => e [13] => f [14] => g [15] => 2 [16] => 3 [17] => 4 [18] => 5 [19] => 6 [20] => 7 [21] => 8 ) Array ( [0] => 1 [1] => a [2] => b [3] => c [4] => d [5] => e [6] => f [7] => g [8] => a [9] => b [10] => c [11] => d [12] => e [13] => f [14] => g [15] => a [16] => b [17] => c [18] => d [19] => e [20] => f [21] => g [22] => 2 [23] => 3 [24] => 4 [25] => 5 [26] => 6 [27] => 7 [28] => 8 ) Array ( [0] => 1 [1] => a [2] => b [3] => c [4] => d [5] => e [6] => f [7] => g [8] => a [9] => b [10] => c [11] => d [12] => e [13] => f [14] => g [15] => a [16] => b [17] => c [18] => d [19] => e [20] => f [21] => g [22] => a [23] => b [24] => c [25] => d [26] => e [27] => f [28] => g [29] => 2 [30] => 3 [31] => 4 [32] => 5 [33] => 6 [34] => 7 [35] => 8 ) Array ( [0] => 1 [1] => a [2] => b [3] => c [4] => d [5] => e [6] => f [7] => g [8] => a [9] => b [10] => c [11] => d [12] => e [13] => f [14] => g [15] => a [16] => b [17] => c [18] => d [19] => e [20] => f [21] => g [22] => a [23] => b [24] => c [25] => d [26] => e [27] => f [28] => g [29] => a [30] => b [31] => c [32] => d [33] => e [34] => f [35] => g [36] => 2 [37] => 3 [38] => 4 [39] => 5 [40] => 6 [41] => 7 [42] => 8 ) Array ( [0] => 1 [1] => a [2] => b [3] => c [4] => d [5] => e [6] => f [7] => g [8] => a [9] => b [10] => c [11] => d [12] => e [13] => f [14] => g [15] => a [16] => b [17] => c [18] => d [19] => e [20] => f [21] => g [22] => a [23] => b [24] => c [25] => d [26] => e [27] => f [28] => g [29] => a [30] => b [31] => c [32] => d [33] => e [34] => f [35] => g [36] => a [37] => b [38] => c [39] => d [40] => e [41] => f [42] => g [43] => 2 [44] => 3 [45] => 4 [46] => 5 [47] => 6 [48] => 7 [49] => 8 ) Array ( [0] => 1 [1] => a [2] => b [3] => c [4] => d [5] => e [6] => f [7] => g [8] => a [9] => b [10] => c [11] => d [12] => e [13] => f [14] => g [15] => a [16] => b [17] => c [18] => d [19] => e [20] => f [21] => g [22] => a [23] => b [24] => c [25] => d [26] => e [27] => f [28] => g [29] => a [30] => b [31] => c [32] => d [33] => e [34] => f [35] => g [36] => a [37] => b [38] => c [39] => d [40] => e [41] => f [42] => g [43] => a [44] => b [45] => c [46] => d [47] => e [48] => f [49] => g [50] => 2 [51] => 3 [52] => 4 [53] => 5 [54] => 6 [55] => 7 [56] => 8 ) Array ( [0] => 1 [1] => a [2] => b [3] => c [4] => d [5] => e [6] => f [7] => g [8] => a [9] => b [10] => c [11] => d [12] => e [13] => f [14] => g [15] => a [16] => b [17] => c [18] => d [19] => e [20] => f [21] => g [22] => a [23] => b [24] => c [25] => d [26] => e [27] => f [28] => g [29] => a [30] => b [31] => c [32] => d [33] => e [34] => f [35] => g [36] => a [37] => b [38] => c [39] => d [40] => e [41] => f [42] => g [43] => a [44] => b [45] => c [46] => d [47] => e [48] => f [49] => g [50] => a [51] => b [52] => c [53] => d [54] => e [55] => f [56] => g [57] => 2 [58] => 3 [59] => 4 [60] => 5 [61] => 6 [62] => 7 [63] => 8 )
Output for hhvm-3.10.0

Process exited with code 153.