Arquivos
hhvm/hphp/test/vm/perf/fibr.php
T
Jordan Delong 363d1bb20f Code move src/ -> hphp/
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.
2013-02-11 02:10:41 -08:00

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);