Write a program to print fibonacci series in Php using while loop

Write a program to print fibonacci series in php using while loop. This program will help you to find the number is Fibonacci. This is important step in every language to getting complex in understanding the concept with maths in programming

<?php 
$number = 0; 
$a = 0; 
$b = 1; 
echo "\n"; 
echo $a.' '.$b.' '; 
while ($number < 10 ) 
{ 
$c = $b + $a; 
echo $c.' '; 
$a = $b; 
$b = $c; 
$number = $number + 1; 
}
?> 

 

Output:

0 1 1 2 3 5 8 13 21 34 55 89

What is fibonacci series in php programming language

The Fibonacci sequence begins with a one or a zero, then a one, and continues according to the rule that each Fibonacci number is equal to the sum of the two numbers preceding it.

Where the fibonacci series is used

The ratios found in Fibonacci’s sequence are used to construct Fibonacci numbers and lines. Fibonacci numbers are widely used in financial markets. Divide specific numbers in the series by other numbers to find these ratios or percentages.

How the fibonacci series help to grow the plants

Because it represents structures and sequences that model physical reality, the Fibonacci sequence emerges in nature. Because it intrinsically models a sort of spiral, we see it in the spiral patterns of certain flowers.

Click here for the article