Can a condition be written within a case statement in PHP switch case?

In PHP, a condition cannot be directly written within a case statement in a switch case. However, you can achieve the same functionality by using if statements within each case block to check for additional conditions.

switch ($variable) {
    case 'value1':
        if ($condition) {
            // code block
        }
        break;
    case 'value2':
        if ($other_condition) {
            // code block
        }
        break;
    default:
        // default case
}