我只是在练习,想看看是否有更健壮的方法来写这个?我应该使用 for 循环吗?
<?php
function recursion($number){
if ($number === 0){
break;
}
else {
$subtracted_number = $number-1;
echo $subtracted_number;
recursion($subtracted_number);
}
}
recursion(9);
?>
//output is 876543210