155. PHP Program to Calculate Factorial of a number using static.
How does this program work?
- This program is used to find the factorial of a given number using PHP.
- Factorial number is defined by the product of all the digits of given number.
- Factorial of 0 is always 1.
Here is the code
<html>
<head>
<title>PHP Program To find the Factorial of a given number</title>
</head>
<body>
<?php
$n = 5;
$factorial = 1;
for ($i = 1; $i <= $n; $i++)
{
$factorial = $factorial * $i;
}
echo "Factorial of number ". $n . " is: " .$factorial;
return 0;
?>
</body>
</html>

