rwec.co.uk

Rowan's World, Et Cetera

The Case for a better Switch

Saturday, August 8th, 2009

The C-style switch-case construct – used in various programming languages, including PHP – is a curious beast. Most commonly used as a streamlined form of if-elseif-else, it actually has more in common with the oldest of control statements, the goto, since control jumps to the first match and carries on until you tell it to [...]