note 23401 deleted from control-structures.switch by hholzgra
| From: | hholzgra@php.net | Date: | Wed, 04 Sep 2002 11:45:19 +0000 |
| Subject: | note 23401 deleted from control-structures.switch by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-36097@lists.php.net to get a copy of this message | ||
Note to chernyshevsky@hotmail.com:
If you quote the string labels in your case statements, you should have no problem using function
names as labels.
I believe you are relying on the fact that php is converting your barewords to strings. In the case
of the word 'print', it's a function and not just a bareword, so php is complaining
about your syntax.
So, your code should be:
switch ($view) {
case 'print':
echo "Show printfriendly version";
break;
default:
echo "Show normal version";
}