Answers for "Factorial program in PHP using recursive function"

0

Factorial program in PHP using recursive function

<?php
function factorial($number) {

    if ($number < 2) {
        return 1;
    } else {
        return ($number * factorial($number-1));
    }
}

echo factorial(4);
?>
Posted by: Guest on June-07-2021

Code answers related to "Factorial program in PHP using recursive function"

Browse Popular Code Answers by Language