Find Fibonacci Number Script

Every number is formed from the sum of the previous two numbers is called the Fibonacci Number.Find Fibonacci Number Script is used to generate a series of Fibonacci numbers, or find out if a particular number.

Demo :



Type Number  

Example :

Type Number : 20

Following code is Find Fibonacci Number Script core if you need copy and use to your website.


<?php
function generateFibonacciNumbers($size)
{
  $fibonacciArray = array();
  $fibonacciArray[0] = 0; // by definition
  $fibonacciArray[1] = 1; // by definition

  for ($x=2; $x<=$size; $x++)
  {
    $fibonacciArray[$x] = $fibonacciArray[$x-2] + $fibonacciArray[$x-1];
  }

  return $fibonacciArray;
}
  echo "Fibonacci number is : ";
  echo implode(" ", generateFibonacciNumbers(20));
?>

In the Fibonacci number sequence, every number is formed from the sum of the previous two numbers. The first few numbers in this sequence are 1, 1, 2, 3, 5, and 8. As the previous listing illustrates, it's fairly easy to convert this rule into working PHP code.

Free Download Script :

If you need to Find Fibonacci Number Script code click and download from following link.

Download




Content