A simple php program recursion function to print the number. In this program we can print the number using recursion function. Functions are “self-contained” code modules that perform a single purpose. Data is often “taken in,” processed, and a result is “returned” by functions. Once you’ve written a function, you can use it over and over again. It’s possible to “call” functions from within other functions.
echo "$num <br/>";
What is recursion function in php program
A recursive function is one that invokes its own function. However, in PHP, you must be careful not to use more than a particular amount of recursive function calls, after the intended result has been obtained, there must be a method to stop the recursion. PHP, like most other programming languages with functions, allows you to build recursive functions.