fork(7) download
  1. <?php
  2.  
  3. $sequence = array();
  4.  
  5. for ($i = 0; $i <= 100 ; $i++) {
  6. if ( $i < 2 ) {
  7. $sequence[$i] = $i;
  8. } else{
  9. $sequence[$i] = $sequence[$i - 1] + $sequence[$i - 2];
  10. }
  11. }
  12.  
  13.  
  14. function fibonacci($n){
  15. global $sequence;
  16. echo $sequence[$n];
  17.  
  18. };
  19.  
  20. fibonacci(100);
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
3.5422484817926E+20