📜  php 程序使用函数查找数字的阶乘 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:10.402000             🧑  作者: Mango

代码示例2
function Factorial($number){ 
    if($number <= 1){   
        return 1;   
    }   
    else{   
        return $number * Factorial($number - 1);   
    }   
} 
  
$number = 5; 
$fact = Factorial($number); 
echo "Factorial = $fact";  //output : 120
?>