How can you optimize the use of switch() statements in PHP to avoid repetition and improve code readability?

Using a switch() statement in PHP can help streamline conditional logic, but it can lead to repetition if not used efficiently. To optimize its use and improve code readability, you can group common cases together and avoid redundant code by using fall-through cases. This approach helps reduce duplication and makes the code easier to maintain.

switch ($variable) {
    case 'case1':
    case 'case2':
        // Common logic for case1 and case2
        break;
    case 'case3':
        // Logic for case3
        break;
    default:
        // Default logic
        break;
}