3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function testSwitch($value) { switch($value) { case 'foo': return 'foo was given'; case 'bar' return 'bar was given'; default: return 'undefined value was given'; } } var_dump(testSwitch('foo')); var_dump(testSwitch('bar')); var_dump(testSwitch(''));
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected 'return' (T_RETURN) in /in/6NREq on line 8
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_RETURN in /in/6NREq on line 8
Process exited with code 255.