What are some potential pitfalls of using if-else statements instead of switch case in PHP code?

Using if-else statements instead of switch case in PHP code can lead to code duplication, decreased readability, and potential performance issues. To solve this problem, you can refactor the if-else statements into a switch case structure, which is more concise and easier to maintain.

// Using switch case instead of if-else statements
$day = "Monday";

switch ($day) {
    case "Monday":
        echo "Today is Monday";
        break;
    case "Tuesday":
        echo "Today is Tuesday";
        break;
    // Add more cases as needed
    default:
        echo "Today is not Monday or Tuesday";
}