The Fibonacci sequence is a set of numbers that starts with a one or a zero, followed by a one, and proceeds based on the rule that each number (called a Fibonacci number) is equal to the sum of the preceding two numbers. For example, A Fibonacci series is 0, 1, 1, 2, 3, 5... here we can easily understand that 0+1 is 1 and the next number is 1+1 = 2 and 1+2 =3 then 2+3 = 5 so on.
<?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;
}
?>
0 1 1 2 3 5 8 13 21 34 55 89