1function Factorial($number){
2 if($number <= 1){
3 return 1;
4 }
5 else{
6 return $number * Factorial($number - 1);
7 }
8}
9
10$number = 5;
11$fact = Factorial($number);
12echo "Factorial = $fact"; //output : 120
13?>