|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-06-23 23:57 UTC] aharvey@php.net
-Type: Bug
+Type: Documentation Problem
-Package: *General Issues
+Package: Documentation problem
[2014-06-23 23:57 UTC] aharvey@php.net
[2014-06-24 00:08 UTC] aharvey@php.net
[2014-06-24 00:08 UTC] aharvey@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: aharvey
[2014-06-24 00:08 UTC] aharvey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 08 12:00:01 2026 UTC |
Description: ------------ My actual version is 5.5.9-1ubuntu4, it wasn't on the list. This is the Ubuntu package version on Ubuntu 14.04. The following code throws a parse error on the second line. The error is: "syntax error, unexpected ' ', expecting endswitch (T_ENDSWITCH) or case (T_CASE) or default (T_DEFAULT)" <?switch($MyVar):?> <?case '1':?> Step One <?break;?> <?case '2':?> Step Two <?break;?> <?endswitch;?> It appears that the closing tag trips up the parser which it should not do when using the alternative switch syntax. Using the following syntax (putting the first case in the same PHP block as the opening switch) works correctly: <?switch($MyVar): case '1':?> Step One <?break;?> <?case '2':?> Step Two <?break;?> <?endswitch;?> Test script: --------------- <?switch($MyVar):?> <?case '1':?> Step One <?break;?> <?case '2':?> Step Two <?break;?> <?endswitch;?>