Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: comp.lang.php Subject: Re: Switch question Date: Mon, 13 Jan 2014 15:32:54 +0100 Lines: 70 Message-ID: <52D3F916.7030407@arnowelzel.de> References: <1jvvn9b20ts0y.1vez76z3aca4b.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net WniYDr9SVdnwWTNLqw9Lgw7fA77ER8KNrIsXxVaibh49nyq0w/ Cancel-Lock: sha1:uYcE/CpJHKtFjNM0ypDzkLLhYV0= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: <1jvvn9b20ts0y.1vez76z3aca4b.dlg@40tude.net> Xref: csiph.com comp.lang.php:12645 Am 12.01.2014 17:48, schrieb richard: > The manual for PHP switch shows no examples on how to use multiple values > for the same case. 1) Go to 2) Use the "Search" box to look for "switch" 3) You should find this: Cite: The statement list for a case can also be empty, which simply passes control into the statement list for the next case. > In liberty basic I would use the following: > case 1,2,3,4 > case "A","B","C" > > What is the equivelant in PHP? > > I use the following code to acquire a value: > $value=$_GET['v']; > switch ($value){ > case "A"; > echo "Does Not Work!"; > case A: > echo "Does Not Work!"; > } > > So what is the proper way to ensure the proper case is found correctly? switch($value) { case 1: case 2: case 3: // dosomething break; // <--- THIS IS IMPORTANT! case A: case B: case C: // dosomethingelse break; //