ID: 11447
Updated by: sniper
Old-Status: Open
Status: Bogus
Bug Type: Scripting Engine problem
Operating system: 
PHP Version: 4.0.4pl1
Assigned To: 

Use the {} instead of the : / endswitch; 


  switch ($value) {
    case: ?>


And anyway, using <? ?> too much is really not good idea.
This is just stupid: <? some code ?><? more code?><? code..?>

Previous Comments:

[2001-06-12 19:13:44] [EMAIL PROTECTED]
Section 7.4 in the FAQ is a little bit related.

Should perhaps the ending for a block of PHP-code be "?>" followed by any number of 
white-space characters?


[2001-06-12 18:51:27] [EMAIL PROTECTED]
The following script gave a parse error:

<? switch($var): ?>
  <? case "alpha": ?>
  <? break; ?>

  <!-- ... -->

<? endswitch; ?>

Parse error: parse error, expecting `T_CASE' or `T_DEFAULT' or `'}'' in 
<my-path>/bug.php on line 2

First I thought that this was really a bug, but then, while typing this report I 
realized that non-PHP-mode characters (like the two spaces) probably are converted to 
an "echo" instruction, so the PHP-parser sees something like the following code:

  echo '  ';
  case "alpha":
    echo '<p>Alpha</p>';

The parser doesn't expect anything (but PHP-mode white-space) to come between the ':' 
on line 1 and 'case' on line 3 and therefore reports parse error. Right?

For the sake of "pretty-scripting", I would like this to change, but at the same time, 
now that I understand why the parser complains, I'm not sure if it should be 


ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to