## EXP.NO: 07 ### TITLE Generate the Fibonacci Series Using PHP User-Defined Function ### AIM To generate the Fibonacci series using a user-defined function in PHP. ### ALGORITHM 1. Create a PHP file to define a user-defined function for generating the Fibonacci series. 2. In the function, initialize the first two terms of the Fibonacci sequence as 0 and 1. 3. Use a loop to calculate the next terms in the series. 4. Display the Fibonacci series for a given number of terms (input by the user). 5. Save and execute the PHP file in XAMPP to verify the result. ### PROGRAM The program below follows your record. It uses a user-defined function named `generateFibonacci()` and generates the first 10 terms. PHP ``` Fibonacci Series

Generate Fibonacci Series using PHP

Fibonacci Series (first $terms terms):"; generateFibonacci($terms); ?> ``` ### OUTPUT Fibonacci Series (first 10 terms): `0 1 1 2 3 5 8 13 21 34` The program displays the Fibonacci series generated by the user-defined function. ### RESULT Thus, the PHP program to generate the Fibonacci series using a user-defined function is executed successfully, and the output is verified.