PHP 4.0 Bug #8114 Updated: case can be terminated by ; as well as : when writing switch statements.

From: Date: Tue, 12 Dec 2000 11:20:40 +0000
Subject: PHP 4.0 Bug #8114 Updated: case can be terminated by ; as well as : when writing switch statements.
Groups: php.dev 
Request: Send a blank email to php-dev+get-40951@lists.php.net to get a copy of this message
ID: 8114 Updated by: stas Reported By: juhl@eisenstein.dk Old-Status: Open Status: Closed Bug Type: Scripting Engine problem Assigned To: Comments: From what I see, this is intended behaviour. I guess that's because of "alternative syntax" (PHP/FI remanant) support. Previous Comments: --------------------------------------------------------------------------- [2000-12-05 05:52:03] juhl@eisenstein.dk When writing switch statements the documentation specifies that the different case statements should be terminated by : (colon), but a ; (semicolon) is also accepted. The code below writes 'Hello world' to the client. I believe it should instead have produced a parse error on the case 'bar'; line. $foo = "bar"; switch ($foo) { case 'bar'; echo 'Hello worldn'; break; default: echo 'Hit the defaultn'; break; } Best regards, Jesper Juhl juhl@eisenstein.dk --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=8114

« previous php.dev (#40951) next »