3v4l.org

run code in 300+ PHP versions simultaneously
<?phpfunction fantastic3($n) { $series = array(0,1,1,1); for($i=3 ; $i<=$n ; $i++){ $a = (isset($series[ (int)$i-3 ]))?$series[ (int)$i-3 ]:0; $b = (isset($series[ (int)$i-2 ]))?$series[ (int)$i-2 ]:0; $c = (isset($series[ (int)$i-1 ]))?$series[ (int)$i-1 ]:0; $d = ($a+$b+$c)-1; if($d<0){ $d = 0; } $series[$i] = $d; } echo $series[ (int)$n-1 ];}// Do NOT call the fantastic3 function in the code// you write. The system will call it automatically.?>
Output for git.master, git.master_jit, rfc.property-hooks
<?phpfunction fantastic3($n) { $series = array(0,1,1,1); for($i=3 ; $i<=$n ; $i++){ $a = (isset($series[ (int)$i-3 ]))?$series[ (int)$i-3 ]:0; $b = (isset($series[ (int)$i-2 ]))?$series[ (int)$i-2 ]:0; $c = (isset($series[ (int)$i-1 ]))?$series[ (int)$i-1 ]:0; $d = ($a+$b+$c)-1; if($d<0){ $d = 0; } $series[$i] = $d; } echo $series[ (int)$n-1 ];}// Do NOT call the fantastic3 function in the code// you write. The system will call it automatically.?>

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:
39.93 ms | 402 KiB | 8 Q