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. Tweet this!