3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test_switch($value) { $matches = ""; switch ($value) { case 0: $matches .= "0 "; } switch ($value) { case 1: $matches .= "1 "; } switch ($value) { case true: $matches .= "true "; } switch ($value) { case false: $matches .= "false "; } switch ($value) { case null: $matches .= "null "; } switch ($value) { case "0": $matches .= "'0' "; } switch ($value) { case "1": $matches .= "'1' "; } return $matches; } foreach (array(0, 1, true, false, null, "0", "1") as $value) { $matches = test_switch($value); var_dump(array('value' => $value, 'matches' => trim($matches))); }
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { ["value"]=> int(0) ["matches"]=> string(16) "0 false null '0'" } array(2) { ["value"]=> int(1) ["matches"]=> string(10) "1 true '1'" } array(2) { ["value"]=> bool(true) ["matches"]=> string(10) "1 true '1'" } array(2) { ["value"]=> bool(false) ["matches"]=> string(16) "0 false null '0'" } array(2) { ["value"]=> NULL ["matches"]=> string(12) "0 false null" } array(2) { ["value"]=> string(1) "0" ["matches"]=> string(11) "0 false '0'" } array(2) { ["value"]=> string(1) "1" ["matches"]=> string(10) "1 true '1'" }

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