eval.in

Paste #164

PHP — PHP 5.4.6, pasted 4 years ago

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<?php

function fib($n) {
  if($n < 2) {
    return $n;
  } else {
    return fib($n - 1) + fib($n - 2);
  }
}

echo fib(30);

Program Output

832040

OK (0.332 sec real, 0.361 sec wall, 13 MB, 44 syscalls)

Fork