<?php
function fibonacci($n)
{
$a = 1;
$b = 1;
for ($i = 0; $i < $n; $i=$i+1)
{
echo “ ”.$a;
$sum = $a+$b;
$a = $b;
$b = $sum;
}
}
echo fibonacci(20);
?>
Output comes like:
1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765