3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getcost($days){ $array=['base' => 100, 'for_2nd' => 70, 'after_2nd' => 50]; if($days==1){ $cost = $array['base'] * $days; }else if($days>=2){ $cost = $array['base'] + ($days == 2 ? $array['for_2nd'] : $array['for_2nd'] + ($days - 2) * $array['after_2nd']); } return $cost.'$'; } echo getcost(1); // it show 100$ echo getcost(2); // it show 170$ echo getcost(3); // it show 220$ echo getcost(4); // it show 270$ echo getcost(5); // it show 320$
Output for git.master, git.master_jit, rfc.property-hooks
100$170$220$270$320$

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:
30.15 ms | 401 KiB | 8 Q