Location: PHPKode > scripts > Factorial and Euler Constant calculation > factorial-and-euler-constant-calculation/functions.php
<?php class factorial_math {
function factorial($num) {

if (($num == 0)||($num == 1)) { return 1; 
} else {
return $num*$this->factorial($num-1);
} }

function calculating_e() {
$iterations = 15;
$fact = 1;
for ($n=1; $n<=$iterations; $n++) {
$fact = $fact*$n;
$chan = 1/$fact;
$result = $result + $chan; }

return $result+1; } 
} ?>

Return current item: Factorial and Euler Constant calculation