mirror of
https://github.com/php/php-src.git
synced 2024-12-01 05:43:38 +08:00
22 lines
231 B
Plaintext
22 lines
231 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<50; $i++) {
|
|
$sum = $sum+factorial($i);
|
|
}
|
|
endfor;
|
|
|
|
print "\$sum=$sum\n";
|
|
|
|
|