Factorial PHP recursively and iteratively

Let’s see the Factorial program in PHP recursively and iteratively.

The factorial of a given positive integer is the product of all positive integers less than and equal to the given positive integer. For example, the factorial of 4!=1*2*3*4=24
The example with PHP code is demonstrated below by calculating the factorial of a number, iteratively and recursively.

Output

The factorial of 4 is: 24
The factorial of 4 is: 24