In this article, We’ll write a program to print a fibonacci series in php.
In mathematics, the Fibonacci numbers, commonly denoted Fn form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1.
$a = 0; $b = 1; echo $a . ", " .$b; for ($i = 0; $i<= 5; $i++) { $c = $a + $b; echo ", " .$c; $a = $b; $b = $c; } // Output 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144
That’s it!. Please share your thoughts or suggestions in the comments below.