3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function echoFibonacciNumber(int $input) { if ($input < 0) { echo "Invalid input"; } if ($input === 0 || $input === 1) { $output = $input; } else { $fi = (sqrt(5) + 1) / 2; $output = floor(pow($fi, $input) / sqrt(5) + 1 / 2); } echo 'input: '.$input.', output: '.$output; } echo echoFibonacciNumber(5);
based on 8SHNn
Output for 7.0.0 - 7.3.0beta1
input: 5, output: 5
Output for 5.3.23 - 5.6.28
Catchable fatal error: Argument 1 passed to echoFibonacciNumber() must be an instance of int, integer given, called in /in/Ii0cH on line 18 and defined in /in/Ii0cH on line 3
Process exited with code 255.