3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $var; switch (false) { case isset($var): $var = ''; echo "Setting var" . PHP_EOL; case $var: // delberiate fall through, case $var is *not* caught, but we end here anyways. $var = 1; echo "Truthing Var" . PHP_EOL; case is_string($var): // delebirate fall through, case is_string($var) is *not* caught, but we end here anyways. $var = (string) $var; echo "Stringing var" . PHP_EOL; break; /* case customGuardFunction() */ default: echo "All checks passed!"; } var_dump($var);
based on jclZ4
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.2.6
Setting var Truthing Var Stringing var string(1) "1"
Output for hhvm-3.15.4
Notice: Undefined variable: var in /in/rAMRi on line 3 Setting var Truthing Var Stringing var string(1) "1"