赞
踩
有一组 1,1,2,3,5,8,13 ? 求第8位的数
function getNum($n){ if($n<=0){ return 0; }else if($n<=2){ return 1; }else if($n>2){ return getNum($n-1)+getNum($n-2); } } $num = getNum(8); echo $num;