3 ms·
As to the Fibonacci numbers: I don't have it but it would be something along the lines of: function fib($n) { if ($n <= 1) { return $n; } else { re
by jkopczewski 13y ago
As to the Fibonacci numbers: I don't have it but it would be something along the lines of:
function fib($n) {
if ($n <= 1) {
return $n;
} else {
return fib($n - 1) + fib($n - 2);
}
}
$n = 30;
$r = fib($n);
echo "Fibonacci number $n is $r\n";
As indicated in the benchmark, it's a dumb exponential implementation.