$number = 4;
$fact = 1;
for ($x=$number; $x>=1; $x--)
$fact = $fact * $x;
echo "fact of $number is $fact";
fact of 4 is 24
What is factorial number and how to find the factorial number in php
The factorial is a quantity defined for all integers larger than or equal to 0. It is denoted by an exclamation point (!). The factorial is the product of all integers less than or equal to n but greater than or equal to 1 for an integer n greater than or equal to 1. Number theorists are fascinated by the factorial.