Input
Output
<?php // Number of terms $n = 10; // Initialize first two terms $first = 0; $second = 1; // Display the first two terms echo "Fibonacci Series up to $n terms:<br>"; echo "$first $second "; // Generate remaining terms for ($i = 3; $i <= $n; $i++) { $next = $first + $second; echo "$next "; $first = $second; $second = $next; } ?>