Jump to content

help with a switch...


glennn.php

Recommended Posts

i don't know if this can be done with a switch() :

 

switch ($val) {

case "value1", case "value2", case "value3" : $par = "Value";

break;

}

 

but you see my intent. can someone tell me a way to use a switch to this effect?

 

(instead of

 

if (($val1 == '') || ($val2 == '') || ($val3 == '')) {

$par = "Value";

}

 

thanks for  your help.

 

GN

Link to comment
https://forums.phpfreaks.com/topic/205277-help-with-a-switch/
Share on other sites

switch ($val) {
     case "value1":
     case "value2":
     case "value3":
          $par = "Value";
     break;
}

 

i don't know if this can be done with a switch() :

 

switch ($val) {

case "value1", case "value2", case "value3" : $par = "Value";

break;

}

 

but you see my intent. can someone tell me a way to use a switch to this effect?

 

(instead of

 

if (($val1 == '') || ($val2 == '') || ($val3 == '')) {

$par = "Value";

}

 

thanks for  your help.

 

GN

Link to comment
https://forums.phpfreaks.com/topic/205277-help-with-a-switch/#findComment-1074451
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.