FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Switch question
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Switch question [message #184631 is a reply to message #184600] Mon, 13 January 2014 14:34 Go to previous messageGo to previous message
Arno Welzel is currently offline  Arno Welzel
Messages: 317
Registered: October 2011
Karma:
Senior Member
Am 12.01.2014 18:18, schrieb Denis McMahon:
> On Sun, 12 Jan 2014 11:48:48 -0500, richard wrote:
>
>> The manual for PHP switch shows no examples on how to use multiple
>> values for the same 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";
>
> This is fucked up, despite what you may believe ":" is not the same as ";"

Nope - unusual - but valid.

According to <http://php.net/manual/en/control-structures.switch.php>, cite:

It's possible to use a semicolon instead of a colon after a case like:

<?php
switch($beer)
{
case 'tuborg';
case 'carlsberg';
case 'heineken';
echo 'Good choice';
break;
default;
echo 'Please make a new selection...';
break;
}
?>



--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: signed int64 pack/unpack
Next Topic: Trouble connecting to a PHP SoapServer module
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 10:31:43 GMT 2024

Total time taken to generate the page: 0.07981 seconds