What are the potential pitfalls of using conditions within case statements in PHP switch case?

Using conditions within case statements in PHP switch case can lead to code that is difficult to read and maintain. It is recommended to keep switch case statements simple and use separate if statements for more complex conditions. This will make the code easier to understand and modify in the future.

// Bad practice: using conditions within case statements
switch ($variable) {
    case ($variable > 5 && $variable < 10):
        // do something
        break;
    case ($variable >= 10 && $variable < 15):
        // do something else
        break;
    default:
        // default case
}

// Good practice: using separate if statements for complex conditions
if ($variable > 5 && $variable < 10) {
    // do something
} elseif ($variable >= 10 && $variable < 15) {
    // do something else
} else {
    // default case
}