3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); while(count($array) > 0){ $first = array_shift($array); foreach($array as $value){ $result[] = $first + $value; } } var_dump($result);
Output for 4.3.0 - 7.1.0
array(190) { [0]=> int(3) [1]=> int(4) [2]=> int(5) [3]=> int(6) [4]=> int(7) [5]=> int(8) [6]=> int(9) [7]=> int(10) [8]=> int(11) [9]=> int(12) [10]=> int(13) [11]=> int(14) [12]=> int(15) [13]=> int(16) [14]=> int(17) [15]=> int(18) [16]=> int(19) [17]=> int(20) [18]=> int(21) [19]=> int(5) [20]=> int(6) [21]=> int(7) [22]=> int(8) [23]=> int(9) [24]=> int(10) [25]=> int(11) [26]=> int(12) [27]=> int(13) [28]=> int(14) [29]=> int(15) [30]=> int(16) [31]=> int(17) [32]=> int(18) [33]=> int(19) [34]=> int(20) [35]=> int(21) [36]=> int(22) [37]=> int(7) [38]=> int(8) [39]=> int(9) [40]=> int(10) [41]=> int(11) [42]=> int(12) [43]=> int(13) [44]=> int(14) [45]=> int(15) [46]=> int(16) [47]=> int(17) [48]=> int(18) [49]=> int(19) [50]=> int(20) [51]=> int(21) [52]=> int(22) [53]=> int(23) [54]=> int(9) [55]=> int(10) [56]=> int(11) [57]=> int(12) [58]=> int(13) [59]=> int(14) [60]=> int(15) [61]=> int(16) [62]=> int(17) [63]=> int(18) [64]=> int(19) [65]=> int(20) [66]=> int(21) [67]=> int(22) [68]=> int(23) [69]=> int(24) [70]=> int(11) [71]=> int(12) [72]=> int(13) [73]=> int(14) [74]=> int(15) [75]=> int(16) [76]=> int(17) [77]=> int(18) [78]=> int(19) [79]=> int(20) [80]=> int(21) [81]=> int(22) [82]=> int(23) [83]=> int(24) [84]=> int(25) [85]=> int(13) [86]=> int(14) [87]=> int(15) [88]=> int(16) [89]=> int(17) [90]=> int(18) [91]=> int(19) [92]=> int(20) [93]=> int(21) [94]=> int(22) [95]=> int(23) [96]=> int(24) [97]=> int(25) [98]=> int(26) [99]=> int(15) [100]=> int(16) [101]=> int(17) [102]=> int(18) [103]=> int(19) [104]=> int(20) [105]=> int(21) [106]=> int(22) [107]=> int(23) [108]=> int(24) [109]=> int(25) [110]=> int(26) [111]=> int(27) [112]=> int(17) [113]=> int(18) [114]=> int(19) [115]=> int(20) [116]=> int(21) [117]=> int(22) [118]=> int(23) [119]=> int(24) [120]=> int(25) [121]=> int(26) [122]=> int(27) [123]=> int(28) [124]=> int(19) [125]=> int(20) [126]=> int(21) [127]=> int(22) [128]=> int(23) [129]=> int(24) [130]=> int(25) [131]=> int(26) [132]=> int(27) [133]=> int(28) [134]=> int(29) [135]=> int(21) [136]=> int(22) [137]=> int(23) [138]=> int(24) [139]=> int(25) [140]=> int(26) [141]=> int(27) [142]=> int(28) [143]=> int(29) [144]=> int(30) [145]=> int(23) [146]=> int(24) [147]=> int(25) [148]=> int(26) [149]=> int(27) [150]=> int(28) [151]=> int(29) [152]=> int(30) [153]=> int(31) [154]=> int(25) [155]=> int(26) [156]=> int(27) [157]=> int(28) [158]=> int(29) [159]=> int(30) [160]=> int(31) [161]=> int(32) [162]=> int(27) [163]=> int(28) [164]=> int(29) [165]=> int(30) [166]=> int(31) [167]=> int(32) [168]=> int(33) [169]=> int(29) [170]=> int(30) [171]=> int(31) [172]=> int(32) [173]=> int(33) [174]=> int(34) [175]=> int(31) [176]=> int(32) [177]=> int(33) [178]=> int(34) [179]=> int(35) [180]=> int(33) [181]=> int(34) [182]=> int(35) [183]=> int(36) [184]=> int(35) [185]=> int(36) [186]=> int(37) [187]=> int(37) [188]=> int(38) [189]=> int(39) }