php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #46095 avoiding some duplicated code (switch)
Submitted: 2008-09-16 13:57 UTC Modified: 2008-09-16 15:27 UTC
From: abdallah at gmx dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.2.6 OS: Windows XP SP3
Private report: No CVE-ID: None
 [2008-09-16 13:57 UTC] abdallah at gmx dot com
Description:
------------
I think the switch instruction should allow a nice technique for the default case:

like this :

Reproduce code:
---------------
switch ($x):

case 'a':
 //some code (eg. 10 lines)
break;

case 'b':
 //some other code (eg. 10 lines)
break;

case 'n':
 //etc...
break;

// And then what that should be nice

default:
goto case 'a';
break;

endswitch;

Expected result:
----------------
Avoid the duplication of the content of case 'A' if we need the default case to act same case 'A'.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-16 15:27 UTC] mkoppanen@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Please read http://php.net/switch with care.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 08:01:32 2024 UTC