eval.in

Paste #179

PHP — PHP 5.4.6, pasted 4 years ago

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

function fib($n) {
  list($a, $b) = array(0, 1);
  for($i = 0; $i < $n; $i++) {
    list($a, $b) = array($b + $a, $a);
  }
  return $a;
}

echo fib(30);

Program Output

832040

OK (0.004 sec real, 0.005 sec wall, 13 MB, 44 syscalls)

Fork