Skip to content

PHP Program 8

Write a program to find the factorial of any number.

<?php  
$num = 9;  
$factorial = 1;  
for ($x=$num; $x>=1; $x--)   
{  
  $factorial = $factorial * $x;  
}  
echo "Factorial of $num is $factorial";  
?>  

Output