Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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);
?>
Source by tutorialsclass.com #
 
PREVIOUS NEXT
Tagged: #Factorial #program #PHP #recursive #function
ADD COMMENT
Topic
Name
8+3 =