3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function fibonacciNumbers($n) { $sq5 = sqrt(5); $a = (1 + $sq5) / 2; $b = (1 - $sq5) / 2; return (pow($a, $n) - pow($b, $n)) / $sq5; } function getArr ($n) { $return = array(); for ($i = 1; $i <= $n; $i++) { $return[] = fibonacciNumbers($i); } return $return; } var_dump(getArr(10));
based on vbnY7
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
array(10) { [0]=> float(1) [1]=> float(1) [2]=> float(2) [3]=> float(3) [4]=> float(5) [5]=> float(8) [6]=> float(13) [7]=> float(21) [8]=> float(34) [9]=> float(55) }