mirror of
https://github.com/php/php-src.git
synced 2024-12-23 00:40:33 +08:00
22 lines
232 B
Plaintext
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";
|
|
|
|
|