Req #81522 [NEW]: Switch...case feature request
| From: | kalonya at outlook dot com | Date: | Tue, 12 Oct 2021 18:55:21 +0000 |
| Subject: | Req #81522 [NEW]: Switch...case feature request | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-237171@lists.php.net to get a copy of this message | ||
From: kalonya at outlook dot com
Operating system: Irrelevant
PHP version: Irrelevant
Package: *Programming Data Structures
Bug Type: Feature/Change Request
Bug description:Switch...case feature request
Description:
------------
I don't know if this is the right place but I'd like to be able to use
switch...case like Java. Without using "break" and assigning the
returned value to a variable directly.
Test script:
---------------
<?php
$day = 2;
$today = switch($day) {
case 1 -> "Monday";
case 2 -> "Tuesday";
case 3 -> "Wednesday";
case 4 -> "Thursday";
case 5 -> "Friday";
case 6 -> "Saturday";
case 7 -> "Sunday";
default -> "Out of day range!";
}
echo "Today is: " . $today . ".";
--
Edit bug report at https://bugs.php.net/bug.php?id=81522&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81522&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81522&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81522&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81522&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81522&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81522&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81522&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81522&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81522&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81522&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81522&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81522&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81522&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81522&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81522&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81522&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81522&r=mysqlcfg