<?php
///不用for求1-100的和
//用递归 100+99+98+97
function setSum($number) {
if ($number > 0) {
$number += setSum($number - 1);
}
return $number;
}
echo setSum(3);
///不用for求1-100的和
//用递归 100+99+98+97
function setSum($number) {
if ($number > 0) {
$number += setSum($number - 1);
}
return $number;
}
echo setSum(3);
?>