Fibonacci code in PHP
Here is the PHP code for Fibonacci series. This will just print the series in screen. If you need the sum upto n-th Fibonacci series number, please let me in the comment box. I will provide the code ASAP.
Code:
Code:
<?php
$n=10;//n-th Fibonacci number
for($a=1,$b=1,$c=0,$i=0;$i<$n;$i++)
{
$c=$a+$b;
if ($i==0) echo $a.' '.$b.' ';
$a=$b;
$b=$c;
echo $c.' ';
}
?>