Possible Duplicate:
Switch vs if statements
In a very simple php scenario, what are the benefits (if any) of :
function foo_1($bar){
if $bar == 'yes'{
return 'yes';
}
// or the use of 'else'
if $bar == 'no'{
return 'no';
}
}
against :
function foo_2($bar){
switch ($bar) {
case 'yes' :
return 'yes';
break;
case 'no' :
return 'no';
break;
}
}
}
(SIDENOTE : I know that if we have multiple conditions ( if ($bar=='yes') && ($bar !='else')..) that might be a reason, but also in that scenario, one can have case with conditions inside ..)