PHP scripts and programs for Beginner to Master

php programs, php ready to use scripts & functions, css tutorials, html, javascripts, ajax examples for Beginner to Master

This is a small program which generates a factorial of a number in php.


function doFactorial ($x) {
if ($x <= 1)
return 1;
else
return ($x * doFactorial ($x-1));
}

while($i<100)
{
print $i." --> ".(doFactorial ($i)) . "
";
$i++;
}
?>



Its a very basic program which generates a factorial of small numbers.

I'm reading: Factorial of a number in phpTweet this!

1 comments:

You should also present a iterative solution or if xdebug.max_nesting_level is set... :)

Post a Comment