Req #61954 [NEW]: Multi-CASE line for SWITCH

From: Date: Sat, 05 May 2012 20:23:47 +0000
Subject: Req #61954 [NEW]: Multi-CASE line for SWITCH
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-170236@lists.php.net to get a copy of this message
From:             
Operating system: N/A
PHP version:      5.4.2
Package:          *General Issues
Bug Type:         Feature/Change Request
Bug description:Multi-CASE line for SWITCH

Description:
------------
---
From manual page: http://www.php.net/control-structures.switch
---
I did not see this capability on the manual page, so please forgive me if
such an improvement is already in the works.

I believe it would be a great help to upgrade the SWITCH -> CASE statements
so they accept multiple values. This would allow us to write only one block
of code-to-be-executed even for multiple values.

Here's an example:

switch ($color) {
   case: "blue", "green", "aqua"
      echo $color . " is a cool color."
      break;
   case: "red", "orange", "brown"
      echo $color . " is a warm color."
}

Also, we could eliminate the need for the BREAK statement by allowing code
after the CASE statement to be enclosed in braces; the closing brace for
that code would indicate an automatic BREAK.

Hope this helps.

David Miller



-- 
Edit bug report at https://bugs.php.net/bug.php?id=61954&edit=1
-- 
Try a snapshot (PHP 5.4):            https://bugs.php.net/fix.php?id=61954&r=trysnapshot54
Try a snapshot (PHP 5.3):            https://bugs.php.net/fix.php?id=61954&r=trysnapshot53
Try a snapshot (trunk):              https://bugs.php.net/fix.php?id=61954&r=trysnapshottrunk
Fixed in SVN:                        https://bugs.php.net/fix.php?id=61954&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61954&r=needdocs
Fixed in release:                    https://bugs.php.net/fix.php?id=61954&r=alreadyfixed
Need backtrace:                      https://bugs.php.net/fix.php?id=61954&r=needtrace
Need Reproduce Script:               https://bugs.php.net/fix.php?id=61954&r=needscript
Try newer version:                   https://bugs.php.net/fix.php?id=61954&r=oldversion
Not developer issue:                 https://bugs.php.net/fix.php?id=61954&r=support
Expected behavior:                   https://bugs.php.net/fix.php?id=61954&r=notwrong
Not enough info:                     https://bugs.php.net/fix.php?id=61954&r=notenoughinfo
Submitted twice:                     https://bugs.php.net/fix.php?id=61954&r=submittedtwice
register_globals:                    https://bugs.php.net/fix.php?id=61954&r=globals
PHP 4 support discontinued:          https://bugs.php.net/fix.php?id=61954&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=61954&r=dst
IIS Stability:                       https://bugs.php.net/fix.php?id=61954&r=isapi
Install GNU Sed:                     https://bugs.php.net/fix.php?id=61954&r=gnused
Floating point limitations:          https://bugs.php.net/fix.php?id=61954&r=float
No Zend Extensions:                  https://bugs.php.net/fix.php?id=61954&r=nozend
MySQL Configuration Error:           https://bugs.php.net/fix.php?id=61954&r=mysqlcfg



Thread (6 messages)

« previous php.bugs (#170236) next »