3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function _makeLongArray($value) { $minLength = 1000 + 1; $resultArray = array(); if (!is_array($value)) { $resultArray = array_pad(array(), $minLength, $value); } else { $count = count($value); if ($count >= $minLength) { $resultArray = $value; } else { while(count($resultArray) < $minLength) { $resultArray = array_merge($resultArray, $value); } } } return $resultArray; } var_dump(_makeLongArray(array(5,6,7)));
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(1002) { [0]=> int(5) [1]=> int(6) [2]=> int(7) [3]=> int(5) [4]=> int(6) [5]=> int(7) [6]=> int(5) [7]=> int(6) [8]=> int(7) [9]=> int(5) [10]=> int(6) [11]=> int(7) [12]=> int(5) [13]=> int(6) [14]=> int(7) [15]=> int(5) [16]=> int(6) [17]=> int(7) [18]=> int(5) [19]=> int(6) [20]=> int(7) [21]=> int(5) [22]=> int(6) [23]=> int(7) [24]=> int(5) [25]=> int(6) [26]=> int(7) [27]=> int(5) [28]=> int(6) [29]=> int(7) [30]=> int(5) [31]=> int(6) [32]=> int(7) [33]=> int(5) [34]=> int(6) [35]=> int(7) [36]=> int(5) [37]=> int(6) [38]=> int(7) [39]=> int(5) [40]=> int(6) [41]=> int(7) [42]=> int(5) [43]=> int(6) [44]=> int(7) [45]=> int(5) [46]=> int(6) [47]=> int(7) [48]=> int(5) [49]=> int(6) [50]=> int(7) [51]=> int(5) [52]=> int(6) [53]=> int(7) [54]=> int(5) [55]=> int(6) [56]=> int(7) [57]=> int(5) [58]=> int(6) [59]=> int(7) [60]=> int(5) [61]=> int(6) [62]=> int(7) [63]=> int(5) [64]=> int(6) [65]=> int(7) [66]=> int(5) [67]=> int(6) [68]=> int(7) [69]=> int(5) [70]=> int(6) [71]=> int(7) [72]=> int(5) [73]=> int(6) [74]=> int(7) [75]=> int(5) [76]=> int(6) [77]=> int(7) [78]=> int(5) [79]=> int(6) [80]=> int(7) [81]=> int(5) [82]=> int(6) [83]=> int(7) [84]=> int(5) [85]=> int(6) [86]=> int(7) [87]=> int(5) [88]=> int(6) [89]=> int(7) [90]=> int(5) [91]=> int(6) [92]=> int(7) [93]=> int(5) [94]=> int(6) [95]=> int(7) [96]=> int(5) [97]=> int(6) [98]=> int(7) [99]=> int(5) [100]=> int(6) [101]=> int(7) [102]=> int(5) [103]=> int(6) [104]=> int(7) [105]=> int(5) [106]=> int(6) [107]=> int(7) [108]=> int(5) [109]=> int(6) [110]=> int(7) [111]=> int(5) [112]=> int(6) [113]=> int(7) [114]=> int(5) [115]=> int(6) [116]=> int(7) [117]=> int(5) [118]=> int(6) [119]=> int(7) [120]=> int(5) [121]=> int(6) [122]=> int(7) [123]=> int(5) [124]=> int(6) [125]=> int(7) [126]=> int(5) [127]=> int(6) [128]=> int(7) [129]=> int(5) [130]=> int(6) [131]=> int(7) [132]=> int(5) [133]=> int(6) [134]=> int(7) [135]=> int(5) [136]=> int(6) [137]=> int(7) [138]=> int(5) [139]=> int(6) [140]=> int(7) [141]=> int(5) [142]=> int(6) [143]=> int(7) [144]=> int(5) [145]=> int(6) [146]=> int(7) [147]=> int(5) [148]=> int(6) [149]=> int(7) [150]=> int(5) [151]=> int(6) [152]=> int(7) [153]=> int(5) [154]=> int(6) [155]=> int(7) [156]=> int(5) [157]=> int(6) [158]=> int(7) [159]=> int(5) [160]=> int(6) [161]=> int(7) [162]=> int(5) [163]=> int(6) [164]=> int(7) [165]=> int(5) [166]=> int(6) [167]=> int(7) [168]=> int(5) [169]=> int(6) [170]=> int(7) [171]=> int(5) [172]=> int(6) [173]=> int(7) [174]=> int(5) [175]=> int(6) [176]=> int(7) [177]=> int(5) [178]=> int(6) [179]=> int(7) [180]=> int(5) [181]=> int(6) [182]=> int(7) [183]=> int(5) [184]=> int(6) [185]=> int(7) [186]=> int(5) [187]=> int(6) [188]=> int(7) [189]=> int(5) [190]=> int(6) [191]=> int(7) [192]=> int(5) [193]=> int(6) [194]=> int(7) [195]=> int(5) [196]=> int(6) [197]=> int(7) [198]=> int(5) [199]=> int(6) [200]=> int(7) [201]=> int(5) [202]=> int(6) [203]=> int(7) [204]=> int(5) [205]=> int(6) [206]=> int(7) [207]=> int(5) [208]=> int(6) [209]=> int(7) [210]=> int(5) [211]=> int(6) [212]=> int(7) [213]=> int(5) [214]=> int(6) [215]=> int(7) [216]=> int(5) [217]=> int(6) [218]=> int(7) [219]=> int(5) [220]=> int(6) [221]=> int(7) [222]=> int(5) [223]=> int(6) [224]=> int(7) [225]=> int(5) [226]=> int(6) [227]=> int(7) [228]=> int(5) [229]=> int(6) [230]=> int(7) [231]=> int(5) [232]=> int(6) [233]=> int(7) [234]=> int(5) [235]=> int(6) [236]=> int(7) [237]=> int(5) [238]=> int(6) [239]=> int(7) [240]=> int(5) [241]=> int(6) [242]=> int(7) [243]=> int(5) [244]=> int(6) [245]=> int(7) [246]=> int(5) [247]=> int(6) [248]=> int(7) [249]=> int(5) [250]=> int(6) [251]=> int(7) [252]=> int(5) [253]=> int(6) [254]=> int(7) [255]=> int(5) [256]=> int(6) [257]=> int(7) [258]=> int(5) [259]=> int(6) [260]=> int(7) [261]=> int(5) [262]=> int(6) [263]=> int(7) [264]=> int(5) [265]=> int(6) [266]=> int(7) [267]=> int(5) [268]=> int(6) [269]=> int(7) [270]=> int(5) [271]=> int(6) [272]=> int(7) [273]=> int(5) [274]=> int(6) [275]=> int(7) [276]=> int(5) [277]=> int(6) [278]=> int(7) [279]=> int(5) [280]=> int(6) [281]=> int(7) [282]=> int(5) [283]=> int(6) [284]=> int(7) [285]=> int(5) [286]=> int(6) [287]=> int(7) [288]=> int(5) [289]=> int(6) [290]=> int(7) [291]=> int(5) [292]=> int(6) [293]=> int(7) [294]=> int(5) [295]=> int(6) [296]=> int(7) [297]=> int(5) [298]=> int(6) [299]=> int(7) [300]=> int(5) [301]=> int(6) [302]=> int(7) [303]=> int(5) [304]=> int(6) [305]=> int(7) [306]=> int(5) [307]=> int(6) [308]=> int(7) [309]=> int(5) [310]=> int(6) [311]=> int(7) [312]=> int(5) [313]=> int(6) [314]=> int(7) [315]=> int(5) [316]=> int(6) [317]=> int(7) [318]=> int(5) [319]=> int(6) [320]=> int(7) [321]=> int(5) [322]=> int(6) [323]=> int(7) [324]=> int(5) [325]=> int(6) [326]=> int(7) [327]=> int(5) [328]=> int(6) [329]=> int(7) [330]=> int(5) [331]=> int(6) [332]=> int(7) [333]=> int(5) [334]=> int(6) [335]=> int(7) [336]=> int(5) [337]=> int(6) [338]=> int(7) [339]=> int(5) [340]=> int(6) [341]=> int(7) [342]=> int(5) [343]=> int(6) [344]=> int(7) [345]=> int(5) [346]=> int(6) [347]=> int(7) [348]=> int(5) [349]=> int(6) [350]=> int(7) [351]=> int(5) [352]=> int(6) [353]=> int(7) [354]=> int(5) [355]=> int(6) [356]=> int(7) [357]=> int(5) [358]=> int(6) [359]=> int(7) [360]=> int(5) [361]=> int(6) [362]=> int(7) [363]=> int(5) [364]=> int(6) [365]=> int(7) [366]=> int(5) [367]=> int(6) [368]=> int(7) [369]=> int(5) [370]=> int(6) [371]=> int(7) [372]=> int(5) [373]=> int(6) [374]=> int(7) [375]=> int(5) [376]=> int(6) [377]=> int(7) [378]=> int(5) [379]=> int(6) [380]=> int(7) [381]=> int(5) [382]=> int(6) [383]=> int(7) [384]=> int(5) [385]=> int(6) [386]=> int(7) [387]=> int(5) [388]=> int(6) [389]=> int(7) [390]=> int(5) [391]=> int(6) [392]=> int(7) [393]=> int(5) [394]=> int(6) [395]=> int(7) [396]=> int(5) [397]=> int(6) [398]=> int(7) [399]=> int(5) [400]=> int(6) [401]=> int(7) [402]=> int(5) [403]=> int(6) [404]=> int(7) [405]=> int(5) [406]=> int(6) [407]=> int(7) [408]=> int(5) [409]=> int(6) [410]=> int(7) [411]=> int(5) [412]=> int(6) [413]=> int(7) [414]=> int(5) [415]=> int(6) [416]=> int(7) [417]=> int(5) [418]=> int(6) [419]=> int(7) [420]=> int(5) [421]=> int(6) [422]=> int(7) [423]=> int(5) [424]=> int(6) [425]=> int(7) [426]=> int(5) [427]=> int(6) [428]=> int(7) [429]=> int(5) [430]=> int(6) [431]=> int(7) [432]=> int(5) [433]=> int(6) [434]=> int(7) [435]=> int(5) [436]=> int(6) [437]=> int(7) [438]=> int(5) [439]=> int(6) [440]=> int(7) [441]=> int(5) [442]=> int(6) [443]=> int(7) [444]=> int(5) [445]=> int(6) [446]=> int(7) [447]=> int(5) [448]=> int(6) [449]=> int(7) [450]=> int(5) [451]=> int(6) [452]=> int(7) [453]=> int(5) [454]=> int(6) [455]=> int(7) [456]=> int(5) [457]=> int(6) [458]=> int(7) [459]=> int(5) [460]=> int(6) [461]=> int(7) [462]=> int(5) [463]=> int(6) [464]=> int(7) [465]=> int(5) [466]=> int(6) [467]=> int(7) [468]=> int(5) [469]=> int(6) [470]=> int(7) [471]=> int(5) [472]=> int(6) [473]=> int(7) [474]=> int(5) [475]=> int(6) [476]=> int(7) [477]=> int(5) [478]=> int(6) [479]=> int(7) [480]=> int(5) [481]=> int(6) [482]=> int(7) [483]=> int(5) [484]=> int(6) [485]=> int(7) [486]=> int(5) [487]=> int(6) [488]=> int(7) [489]=> int(5) [490]=> int(6) [491]=> int(7) [492]=> int(5) [493]=> int(6) [494]=> int(7) [495]=> int(5) [496]=> int(6) [497]=> int(7) [498]=> int(5) [499]=> int(6) [500]=> int(7) [501]=> int(5) [502]=> int(6) [503]=> int(7) [504]=> int(5) [505]=> int(6) [506]=> int(7) [507]=> int(5) [508]=> int(6) [509]=> int(7) [510]=> int(5) [511]=> int(6) [512]=> int(7) [513]=> int(5) [514]=> int(6) [515]=> int(7) [516]=> int(5) [517]=> int(6) [518]=> int(7) [519]=> int(5) [520]=> int(6) [521]=> int(7) [522]=> int(5) [523]=> int(6) [524]=> int(7) [525]=> int(5) [526]=> int(6) [527]=> int(7) [528]=> int(5) [529]=> int(6) [530]=> int(7) [531]=> int(5) [532]=> int(6) [533]=> int(7) [534]=> int(5) [535]=> int(6) [536]=> int(7) [537]=> int(5) [538]=> int(6) [539]=> int(7) [540]=> int(5) [541]=> int(6) [542]=> int(7) [543]=> int(5) [544]=> int(6) [545]=> int(7) [546]=> int(5) [547]=> int(6) [548]=> int(7) [549]=> int(5) [550]=> int(6) [551]=> int(7) [552]=> int(5) [553]=> int(6) [554]=> int(7) [555]=> int(5) [556]=> int(6) [557]=> int(7) [558]=> int(5) [559]=> int(6) [560]=> int(7) [561]=> int(5) [562]=> int(6) [563]=> int(7) [564]=> int(5) [565]=> int(6) [566]=> int(7) [567]=> int(5) [568]=> int(6) [569]=> int(7) [570]=> int(5) [571]=> int(6) [572]=> int(7) [573]=> int(5) [574]=> int(6) [575]=> int(7) [576]=> int(5) [577]=> int(6) [578]=> int(7) [579]=> int(5) [580]=> int(6) [581]=> int(7) [582]=> int(5) [583]=> int(6) [584]=> int(7) [585]=> int(5) [586]=> int(6) [587]=> int(7) [588]=> int(5) [589]=> int(6) [590]=> int(7) [591]=> int(5) [592]=> int(6) [593]=> int(7) [594]=> int(5) [595]=> int(6) [596]=> int(7) [597]=> int(5) [598]=> int(6) [599]=> int(7) [600]=> int(5) [601]=> int(6) [602]=> int(7) [603]=> int(5) [604]=> int(6) [605]=> int(7) [606]=> int(5) [607]=> int(6) [608]=> int(7) [609]=> int(5) [610]=> int(6) [611]=> int(7) [612]=> int(5) [613]=> int(6) [614]=> int(7) [615]=> int(5) [616]=> int(6) [617]=> int(7) [618]=> int(5) [619]=> int(6) [620]=> int(7) [621]=> int(5) [622]=> int(6) [623]=> int(7) [624]=> int(5) [625]=> int(6) [626]=> int(7) [627]=> int(5) [628]=> int(6) [629]=> int(7) [630]=> int(5) [631]=> int(6) [632]=> int(7) [633]=> int(5) [634]=> int(6) [635]=> int(7) [636]=> int(5) [637]=> int(6) [638]=> int(7) [639]=> int(5) [640]=> int(6) [641]=> int(7) [642]=> int(5) [643]=> int(6) [644]=> int(7) [645]=> int(5) [646]=> int(6) [647]=> int(7) [648]=> int(5) [649]=> int(6) [650]=> int(7) [651]=> int(5) [652]=> int(6) [653]=> int(7) [654]=> int(5) [655]=> int(6) [656]=> int(7) [657]=> int(5) [658]=> int(6) [659]=> int(7) [660]=> int(5) [661]=> int(6) [662]=> int(7) [663]=> int(5) [664]=> int(6) [665]=> int(7) [666]=> int(5) [667]=> int(6) [668]=> int(7) [669]=> int(5) [670]=> int(6) [671]=> int(7) [672]=> int(5) [673]=> int(6) [674]=> int(7) [675]=> int(5) [676]=> int(6) [677]=> int(7) [678]=> int(5) [679]=> int(6) [680]=> int(7) [681]=> int(5) [682]=> int(6) [683]=> int(7) [684]=> int(5) [685]=> int(6) [686]=> int(7) [687]=> int(5) [688]=> int(6) [689]=> int(7) [690]=> int(5) [691]=> int(6) [692]=> int(7) [693]=> int(5) [694]=> int(6) [695]=> int(7) [696]=> int(5) [697]=> int(6) [698]=> int(7) [699]=> int(5) [700]=> int(6) [701]=> int(7) [702]=> int(5) [703]=> int(6) [704]=> int(7) [705]=> int(5) [706]=> int(6) [707]=> int(7) [708]=> int(5) [709]=> int(6) [710]=> int(7) [711]=> int(5) [712]=> int(6) [713]=> int(7) [714]=> int(5) [715]=> int(6) [716]=> int(7) [717]=> int(5) [718]=> int(6) [719]=> int(7) [720]=> int(5) [721]=> int(6) [722]=> int(7) [723]=> int(5) [724]=> int(6) [725]=> int(7) [726]=> int(5) [727]=> int(6) [728]=> int(7) [729]=> int(5) [730]=> int(6) [731]=> int(7) [732]=> int(5) [733]=> int(6) [734]=> int(7) [735]=> int(5) [736]=> int(6) [737]=> int(7) [738]=> int(5) [739]=> int(6) [740]=> int(7) [741]=> int(5) [742]=> int(6) [743]=> int(7) [744]=> int(5) [745]=> int(6) [746]=> int(7) [747]=> int(5) [748]=> int(6) [749]=> int(7) [750]=> int(5) [751]=> int(6) [752]=> int(7) [753]=> int(5) [754]=> int(6) [755]=> int(7) [756]=> int(5) [757]=> int(6) [758]=> int(7) [759]=> int(5) [760]=> int(6) [761]=> int(7) [762]=> int(5) [763]=> int(6) [764]=> int(7) [765]=> int(5) [766]=> int(6) [767]=> int(7) [768]=> int(5) [769]=> int(6) [770]=> int(7) [771]=> int(5) [772]=> int(6) [773]=> int(7) [774]=> int(5) [775]=> int(6) [776]=> int(7) [777]=> int(5) [778]=> int(6) [779]=> int(7) [780]=> int(5) [781]=> int(6) [782]=> int(7) [783]=> int(5) [784]=> int(6) [785]=> int(7) [786]=> int(5) [787]=> int(6) [788]=> int(7) [789]=> int(5) [790]=> int(6) [791]=> int(7) [792]=> int(5) [793]=> int(6) [794]=> int(7) [795]=> int(5) [796]=> int(6) [797]=> int(7) [798]=> int(5) [799]=> int(6) [800]=> int(7) [801]=> int(5) [802]=> int(6) [803]=> int(7) [804]=> int(5) [805]=> int(6) [806]=> int(7) [807]=> int(5) [808]=> int(6) [809]=> int(7) [810]=> int(5) [811]=> int(6) [812]=> int(7) [813]=> int(5) [814]=> int(6) [815]=> int(7) [816]=> int(5) [817]=> int(6) [818]=> int(7) [819]=> int(5) [820]=> int(6) [821]=> int(7) [822]=> int(5) [823]=> int(6) [824]=> int(7) [825]=> int(5) [826]=> int(6) [827]=> int(7) [828]=> int(5) [829]=> int(6) [830]=> int(7) [831]=> int(5) [832]=> int(6) [833]=> int(7) [834]=> int(5) [835]=> int(6) [836]=> int(7) [837]=> int(5) [838]=> int(6) [839]=> int(7) [840]=> int(5) [841]=> int(6) [842]=> int(7) [843]=> int(5) [844]=> int(6) [845]=> int(7) [846]=> int(5) [847]=> int(6) [848]=> int(7) [849]=> int(5) [850]=> int(6) [851]=> int(7) [852]=> int(5) [853]=> int(6) [854]=> int(7) [855]=> int(5) [856]=> int(6) [857]=> int(7) [858]=> int(5) [859]=> int(6) [860]=> int(7) [861]=> int(5) [862]=> int(6) [863]=> int(7) [864]=> int(5) [865]=> int(6) [866]=> int(7) [867]=> int(5) [868]=> int(6) [869]=> int(7) [870]=> int(5) [871]=> int(6) [872]=> int(7) [873]=> int(5) [874]=> int(6) [875]=> int(7) [876]=> int(5) [877]=> int(6) [878]=> int(7) [879]=> int(5) [880]=> int(6) [881]=> int(7) [882]=> int(5) [883]=> int(6) [884]=> int(7) [885]=> int(5) [886]=> int(6) [887]=> int(7) [888]=> int(5) [889]=> int(6) [890]=> int(7) [891]=> int(5) [892]=> int(6) [893]=> int(7) [894]=> int(5) [895]=> int(6) [896]=> int(7) [897]=> int(5) [898]=> int(6) [899]=> int(7) [900]=> int(5) [901]=> int(6) [902]=> int(7) [903]=> int(5) [904]=> int(6) [905]=> int(7) [906]=> int(5) [907]=> int(6) [908]=> int(7) [909]=> int(5) [910]=> int(6) [911]=> int(7) [912]=> int(5) [913]=> int(6) [914]=> int(7) [915]=> int(5) [916]=> int(6) [917]=> int(7) [918]=> int(5) [919]=> int(6) [920]=> int(7) [921]=> int(5) [922]=> int(6) [923]=> int(7) [924]=> int(5) [925]=> int(6) [926]=> int(7) [927]=> int(5) [928]=> int(6) [929]=> int(7) [930]=> int(5) [931]=> int(6) [932]=> int(7) [933]=> int(5) [934]=> int(6) [935]=> int(7) [936]=> int(5) [937]=> int(6) [938]=> int(7) [939]=> int(5) [940]=> int(6) [941]=> int(7) [942]=> int(5) [943]=> int(6) [944]=> int(7) [945]=> int(5) [946]=> int(6) [947]=> int(7) [948]=> int(5) [949]=> int(6) [950]=> int(7) [951]=> int(5) [952]=> int(6) [953]=> int(7) [954]=> int(5) [955]=> int(6) [956]=> int(7) [957]=> int(5) [958]=> int(6) [959]=> int(7) [960]=> int(5) [961]=> int(6) [962]=> int(7) [963]=> int(5) [964]=> int(6) [965]=> int(7) [966]=> int(5) [967]=> int(6) [968]=> int(7) [969]=> int(5) [970]=> int(6) [971]=> int(7) [972]=> int(5) [973]=> int(6) [974]=> int(7) [975]=> int(5) [976]=> int(6) [977]=> int(7) [978]=> int(5) [979]=> int(6) [980]=> int(7) [981]=> int(5) [982]=> int(6) [983]=> int(7) [984]=> int(5) [985]=> int(6) [986]=> int(7) [987]=> int(5) [988]=> int(6) [989]=> int(7) [990]=> int(5) [991]=> int(6) [992]=> int(7) [993]=> int(5) [994]=> int(6) [995]=> int(7) [996]=> int(5) [997]=> int(6) [998]=> int(7) [999]=> int(5) [1000]=> int(6) [1001]=> int(7) }