What is the purpose of using switch case in PHP and how does it differ from using if-else statements?

Switch case in PHP is used to simplify code readability and maintainability when dealing with multiple possible conditions. It is especially useful when there are many different cases to consider. Switch case statements can be more efficient than using multiple if-else statements, as the code only evaluates the expression once and then jumps to the matching case.

$day = "Monday";

switch($day) {
    case "Monday":
        echo "Today is Monday";
        break;
    case "Tuesday":
        echo "Today is Tuesday";
        break;
    case "Wednesday":
        echo "Today is Wednesday";
        break;
    default:
        echo "Today is not a weekday";
}