php uses recursive functions to implement number accumulation, recursive accumulation
This article describes the example of php using recursive functions to implement number accumulation. Share it with everyone for your reference. The specific implementation method is as follows:
<?php
function summation ($count) {
if ($count != 0) :
return $count + summation($count-1);
endif;
}
$sum = summation(10);
print "Summation = $sum";
?>
Copy after login
I hope this article will be helpful to everyone’s PHP programming design.
http://www.bkjia.com/PHPjc/968263.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/968263.htmlTechArticlephp uses recursive functions to achieve digital accumulation. Recursive accumulation This article describes how PHP uses recursive functions to achieve digital accumulation. method. Share it with everyone for your reference. Specific implementation method...