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