function getnum($n){
if ($n == 0) return 0;
$arr = array();
$arr[2] = $arr[1] = 1;
for ($i = 3; $i <= $n; $i++) {
$arr[$i] = $arr[$i-1] + $arr[$i-2];
}
return end($arr);
}
$arr = getnum(10);
print_r($arr);
function getnum($n){
if ($n == 0) return 0;
$arr = array();
$arr[2] = $arr[1] = 1;
for ($i = 3; $i <= $n; $i++) {
$arr[$i] = $arr[$i-1] + $arr[$i-2];
}
return end($arr);
}
$arr = getnum(10);
print_r($arr);