php-src/tests/recurse
1999-07-08 21:56:19 +00:00

22 lines
232 B
Plaintext

<?
function factorial($n)
{
if ($n==0 || $n==1) {
return 1;
} else {
return $n*factorial($n-1);
}
}
for ($k=0; $k<10; $k++):
for ($i=0,$sum=0; $i<150; $i++) {
$sum = $sum+factorial($i);
}
endfor;
print "\$sum=$sum\n";