363d1bb20f
This change is mostly for FB internal organizational reasons. Building is not effected beyond the fact that the target now lands in hphp/hhvm/hhvm rather than src/hhvm/hhvm.
20 linhas
316 B
PHP
20 linhas
316 B
PHP
<?php
|
|
|
|
# Compute the n'th Fibonacci number recursively, where n >= 0.
|
|
function fib($n) {
|
|
if ($n > 1) {
|
|
return fib($n-2) + fib($n-1);
|
|
} else {
|
|
return $n;
|
|
}
|
|
}
|
|
|
|
function tail_recurse($n) {
|
|
if ($n > 0) {
|
|
tail_recurse($n-1);
|
|
}
|
|
print $n; print ": "; print fib($n); print "\n";
|
|
}
|
|
|
|
tail_recurse(35);
|