Fibonacci Series in PHP Using While Loop

Fibonacci series in Php. 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

Fibonacci Series in PHP

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. 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.

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.