DWPD-2.5: Write PHP Script to print Fibonacci series.

Lab # 2
Basics of PHP

5. Write PHP Script to print Fibonacci series. 


Lab-2-5-Fibonacci-series.php

<?php
$f1=0;
$f2=1;
$n=5;
echo $f1."<br>".$f2."<br>";
for($i=0;$i<$n;$i++)
{
$f=$f1+$f2;
$f1=$f2;
$f2=$f;
echo $f."<br>";
}
?>


Output

Fibonacci series output
Fibonacci Series in php | by Practical Server


visit: codesnail.com

Happy Coding 🙂

Leave a comment