I've never seen this variation of the switch statement, could you guys please comment on it?
switch ($language) {
case 'German':
echo 'Hallo, Welt!';
break;
case 'Italian':
echo 'Ciao, mondo!';
break;
case 'Spanish':
echo 'Hola, mundo!';
break;
case 'English':
default:
echo 'Hello, world!';
break;
}
What surprised me is the last four lines:
case 'English':
default:
echo 'Hello, world!';
break;
I thought the default should be set without mentioning the case before. Is that a legitimate way of doing things or just a typo in the book?