3v4l.org

run code in 300+ PHP versions simultaneously
<?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 /* case customGuardFunction() */ default: echo "All checks passed!"; } var_dump($var);
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.7
Parse error: syntax error, unexpected 'case' (T_CASE), expecting ',' or ';' in /in/jclZ4 on line 14
Process exited with code 255.

preferences:
158.58 ms | 1399 KiB | 36 Q