Advertisement
DraKiNs

[COD] Fibonacci PHP

Jun 30th, 2011
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.36 KB | None | 0 0
  1. function GenerateFibonacciNumber($iMaxVal = 10)
  2. {
  3.     $iFibonacci[4];
  4.     $iFibonacci[1] = 1;
  5.  
  6.     echo("VALUE: 0<br>");
  7.     echo("VALUE: 1 <br>");
  8.  
  9.     for($i; $i < $iMaxVal; $i++)
  10.     {
  11.         $iFibonacci[3] = $iFibonacci[1];
  12.         $iFibonacci[1] = ($iFibonacci[1] + $iFibonacci[0]);
  13.         $iFibonacci[0] = $iFibonacci[3];
  14.  
  15.         echo("VALUE: ".$iFibonacci[1]."<br>");
  16.     }
  17.     return true;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement