Search
 
SCRIPT & CODE EXAMPLE
 

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);
?>
Comment

PREVIOUS NEXT
Code Example
Php :: how to take last entry in database in laravel Method ONe 
Php :: get categories wordpress query 
Php :: laravel orderby with relation 
Php :: laravel eloquent get last 
Php :: Laravel seed timestamps columns 
Php :: get raw query laravel 
Php :: joomla login link 
Php :: how to install multiple php versions ubuntu 
Php :: php array remove value if exists 
Php :: limit 1 1 in laravel query 
Php :: read global laravel request() 
Php :: php move_uploaded_file 
Php :: composer autoload psr-4 
Php :: cache clear in laravel 
Php :: php remove line if it contains string 
Php :: password strength php 
Php :: get name custom post type wordpress 
Php :: how to generate random string in laravel 
Php :: php routing 
Php :: laravel curl request 
Php :: laravel join table 
Php :: how to pass id through get template part 
Php :: eloquent get distinct 
Php :: interface x trait in php 
Php :: max. post size 
Php :: laravel Command "laravel/ui" is not defined. 
Php :: php regex file extension 
Php :: calculate sum (total) of column in php 
Php :: php get first 10 elements of array 
Php :: laravel required_with 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =