Regarding the problem of PHP recursion, please ask someone
。
2019-04-19 11:43:41
0
0
729
function sum($shu){
if ($shu>1) {
return $shu + sum($shu - 1);
# code...
}else{
return 1;
}
}
echo sum(5);

How do you analyze this code and finally get the result 15? I went to some PHP groups and asked someone who said:

5 (5-1 4-1 3-1 2-1 1 ) Calculated in this way, the $shu retains the original number, and I don’t think the people in the tutorial said this. The $shu will also change QQ浏览器截图20190419114111.png instead of always being 5QQ浏览器截图20190419114111.pngWhich analysis is the best? That's right. I'm a beginner who just started, so I was confused. I didn't understand the analysis in the tutorial, but I could understand the analysis asked in the group.


。

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template