3v4l.org

run code in 300+ PHP versions simultaneously
<?php for ($i = 0; $i < 16; $i++) { var_dump(method($i) . "\t" . method1($i) . "\t" . pow(2, $i-1)); } function method($n) { if ($n <= 0) return 0; if ($n == 1) return 1; if ($n == 2) return 2; if ($n == 3) return 4; return method($n - 1) + method($n - 2) + method($n - 3); } function method1($n) { if ($n <= 0) return 0; $r = 1; for ($i = 0; $i < $n; $i++) { $r += method1($i); } return $r; }
Output for git.master, git.master_jit, rfc.property-hooks
string(7) "0 0 0.5" string(5) "1 1 1" string(5) "2 2 2" string(5) "4 4 4" string(5) "7 8 8" string(8) "13 16 16" string(8) "24 32 32" string(8) "44 64 64" string(10) "81 128 128" string(11) "149 256 256" string(11) "274 512 512" string(13) "504 1024 1024" string(13) "927 2048 2048" string(14) "1705 4096 4096" string(14) "3136 8192 8192" string(16) "5768 16384 16384"

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
73.79 ms | 402 KiB | 8 Q