fork download
  1. <?php
  2.  
  3. function fib($a) {
  4. if($a == 1) {
  5. return 0;
  6. } elseif($a == 2) {
  7. return 1;
  8. } else {
  9. return fib($a-1) + fib($a-2);
  10. }
  11. }
  12.  
  13.  
  14. $a = fib(10);
  15.  
  16. echo "$a";
Success #stdin #stdout 0.02s 24448KB
stdin
Standard input is empty
stdout
34