If you have the following:
$var = 3; // we'll say it's set to 3 for this example
if ($var == 4) {
// do something
} else if ($var == 5) {
// do something
} else if ($var == 2) {
// do something
} else if ($var == 3) {
// do something
} else {
// do something
}
If say 80% of the time $var
is 3, do you worry about the fact that it's going through 4 if cases before finding the true case?
I'm thinking on a small site it's not a big deal, but what about when that if statement is going to run 1000s of times a second?
I'm working in PHP, but I'm thinking the language doesn't matter.