Arquivos
hhvm/hphp/test/vm-perf/fibr.php
T
ptarjan 6e2868de3e allow recursive test running
I found a bajillion more tests in the Zend repo, and I'm going to have to namespace things. I think this solution will also be nice for the porting our C++ strings. One directory per package and then when you want to run them all you run the top-level.
2013-04-04 15:38:59 -07: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);