Fibonacci Series - Php

How to calculate fibonacci series using php code?

Snippet Code

Rate this page :
  [ 0 votes]

This code can be used to display the fibonacci series. Give the maximum number in "num" value "for($i=0;$i<$num;$i )". For example, first 10 Fibonacci numbers are displayed here.

<?php echo "Fibonacci Series :"; echo "</br>"; $a = 0; $b = 1; $num=10; for($i=0;$i<$num;$i++) { $c = $a + $b; echo $c."</br>"; $a=$b; $b=$c; } ?>


Ask Questions

Ask Question