function factorial($n) {
// base case
if ($n == 0) {
return 1;
}
// recursive case
return $n * factorial($n - 1);
}
//example
$result = factorial(5);
//output
echo $result; //120
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)