The factorial of a number n is defined by the product of all the digits from 1 to n (including 1 and n).
The simplest way to find the factorial of a number is by using a loop.
There are two ways to find factorial in PHP:
Factorial in PHP
Factorial of 4 using for loop is shown below.
Factorial using Form in PHP
Below program shows a form through which you can calculate factorial of any number.
Factorial using Recursion in PHP
Factorial of 6 using recursion method is shown.