3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function fibonacci($n,$first = 0,$second = 1) { $fib = [$first,$second]; for($i=1;$i<$n;$i++) { $fib[] = $fib[$i]+$fib[$i-1]; } return $fib; } echo "<pre>"; print_r(fibonacci(150));
Output for 5.4.0 - 7.2.0
<pre>Array ( [0] => 0 [1] => 1 [2] => 1 [3] => 2 [4] => 3 [5] => 5 [6] => 8 [7] => 13 [8] => 21 [9] => 34 [10] => 55 [11] => 89 [12] => 144 [13] => 233 [14] => 377 [15] => 610 [16] => 987 [17] => 1597 [18] => 2584 [19] => 4181 [20] => 6765 [21] => 10946 [22] => 17711 [23] => 28657 [24] => 46368 [25] => 75025 [26] => 121393 [27] => 196418 [28] => 317811 [29] => 514229 [30] => 832040 [31] => 1346269 [32] => 2178309 [33] => 3524578 [34] => 5702887 [35] => 9227465 [36] => 14930352 [37] => 24157817 [38] => 39088169 [39] => 63245986 [40] => 102334155 [41] => 165580141 [42] => 267914296 [43] => 433494437 [44] => 701408733 [45] => 1134903170 [46] => 1836311903 [47] => 2971215073 [48] => 4807526976 [49] => 7778742049 [50] => 12586269025 [51] => 20365011074 [52] => 32951280099 [53] => 53316291173 [54] => 86267571272 [55] => 139583862445 [56] => 225851433717 [57] => 365435296162 [58] => 591286729879 [59] => 956722026041 [60] => 1548008755920 [61] => 2504730781961 [62] => 4052739537881 [63] => 6557470319842 [64] => 10610209857723 [65] => 17167680177565 [66] => 27777890035288 [67] => 44945570212853 [68] => 72723460248141 [69] => 117669030460994 [70] => 190392490709135 [71] => 308061521170129 [72] => 498454011879264 [73] => 806515533049393 [74] => 1304969544928657 [75] => 2111485077978050 [76] => 3416454622906707 [77] => 5527939700884757 [78] => 8944394323791464 [79] => 14472334024676221 [80] => 23416728348467685 [81] => 37889062373143906 [82] => 61305790721611591 [83] => 99194853094755497 [84] => 160500643816367088 [85] => 259695496911122585 [86] => 420196140727489673 [87] => 679891637638612258 [88] => 1100087778366101931 [89] => 1779979416004714189 [90] => 2880067194370816120 [91] => 4660046610375530309 [92] => 7540113804746346429 [93] => 1.2200160415122E+19 [94] => 1.9740274219868E+19 [95] => 3.194043463499E+19 [96] => 5.1680708854858E+19 [97] => 8.3621143489848E+19 [98] => 1.3530185234471E+20 [99] => 2.1892299583456E+20 [100] => 3.5422484817926E+20 [101] => 5.7314784401382E+20 [102] => 9.2737269219308E+20 [103] => 1.5005205362069E+21 [104] => 2.4278932284E+21 [105] => 3.9284137646069E+21 [106] => 6.3563069930068E+21 [107] => 1.0284720757614E+22 [108] => 1.6641027750621E+22 [109] => 2.6925748508234E+22 [110] => 4.3566776258855E+22 [111] => 7.0492524767089E+22 [112] => 1.1405930102594E+23 [113] => 1.8455182579303E+23 [114] => 2.9861112681898E+23 [115] => 4.8316295261201E+23 [116] => 7.8177407943099E+23 [117] => 1.264937032043E+24 [118] => 2.046711111474E+24 [119] => 3.311648143517E+24 [120] => 5.358359254991E+24 [121] => 8.670007398508E+24 [122] => 1.4028366653499E+25 [123] => 2.2698374052007E+25 [124] => 3.6726740705506E+25 [125] => 5.9425114757513E+25 [126] => 9.6151855463018E+25 [127] => 1.5557697022053E+26 [128] => 2.5172882568355E+26 [129] => 4.0730579590408E+26 [130] => 6.5903462158763E+26 [131] => 1.0663404174917E+27 [132] => 1.7253750390793E+27 [133] => 2.7917154565711E+27 [134] => 4.5170904956504E+27 [135] => 7.3088059522214E+27 [136] => 1.1825896447872E+28 [137] => 1.9134702400093E+28 [138] => 3.0960598847965E+28 [139] => 5.0095301248058E+28 [140] => 8.1055900096024E+28 [141] => 1.3115120134408E+29 [142] => 2.1220710144011E+29 [143] => 3.4335830278419E+29 [144] => 5.5556540422429E+29 [145] => 8.9892370700848E+29 [146] => 1.4544891112328E+30 [147] => 2.3534128182413E+30 [148] => 3.807901929474E+30 [149] => 6.1613147477153E+30 [150] => 9.9692166771893E+30 )
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/QMaGp on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/QMaGp on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/QMaGp on line 5
Process exited with code 255.