> One issue that was discussed a few weeks ago, and led to the current syntax, > was too many variations within the switch syntax; of course, trying to do it > all in one syntax is perpetuating that problem. However, I think Rowan has > suggested a syntax that may be sufficiently self-documenting. To wit, > independent of rustmatch (above): > > switch ($foo) { > case 1: { > Many statements here. > } > case 2: { > Many statements here. > } > } > > The curly braces are already understood by most PHPers to mean "a block of > statements", and so it's a logical jump in this case. As Rowan suggests, the > {} imply a break. To keep it simple we should probably not allow mixing and > matching in a single switch. Either list-style (break required) or {}-style > (break implied). > > That handles break;
Sadly, it doesn't. That code is valid today: <?php $foo = 1; switch ($foo) { case 1: { echo "1\n"; } case 2: { echo "2\n"; } } ?> Which outputs: 1 2 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php