php microtime function fib if return else return fib fib fib int _GET

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<?php
$t = microtime(1);
function fib($n) {
if ($n < 2) {
return 1;
} else {
return fib($n - 1) + fib($n - 2);
}
}
$fib = (int) $_GET['fib'];
echo fib($fib);
printf("<br />%.4f sec.", microtime(1) - $t);