Write a PHP program to print first 10 Fibonacci numbers

PHP program to print first 10 Fibonacci numbers.


In this tutorial, you will learn how to print the Fibonacci series in php. PHP Fibonacci Series Program

Below is the php script to print the Fibonacci series in php.

<html>
<head>
    <title>PHP program to print first 10 Fibonacci numbers</title>    
</head>
<body>

    <h3>FIBONACCI SERIES</h3>

    <?php
        $count=0;
        $f1=0;
        $f2=1;

        echo "$f1<br>";
        echo "$f2<br>";

        while($count < 8 )
        {
            $f3=$f1+$f2;

            echo "$f3<br>";

            $f1=$f2;
            $f2=$f3;
           
            $count=$count+1;
        }
    ?>
</body>
</html>


Thanks for reading.