Is something like this possible or should I just use 500 lines of if
and else
logic instead of switch
?
<?php
switch ( $something ) {
case 'one' :
if( /* case 'two' is also the case */ ) {
$color = 'red';
break;
}
else {
$color-1 = 'black';
break;
}
case 'two' :
if( /* case 'one' is also the case */ ) {
$color = 'red';
break;
}
else {
$color-2 = 'white';
break;
}
}
?>
Do I lose a lot in performance if I use a lot of if
statements instead of switch
?
Aucun commentaire:
Enregistrer un commentaire