PHP Simple FIbonacci Script

Yeay... Momo Lovers (LOL) :'D
It has been a long time since I've focused on something, I didn't create anything strange anymore here. :'D

While I am preparing for something and then looking for some of basic algorithm again like I used to do some years ago, I found about Fibonacci Sequence Logic.
(As always, I immediately zonked out when learning something overnight -_- Zzzzz )

What is Fibonacci?
Fibonacci is the sequence that let each number value adding itself with the value preceding to it.


<?

$first=0;
$second=1;

echo "$first $second";

for($i=1; $i<=6; $i++)
{
$third=$a+$b;
$first=$second;
$second=$third;

echo "$third ";
}
?>

The result will be:
 0  1  1  2  3  5 



0 comments: