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