What are the advantages of using if statements instead of switch statements for time-based logic in PHP?

When dealing with time-based logic in PHP, using if statements can be more flexible and easier to read compared to switch statements. If statements allow for more complex conditions to be easily implemented, making it simpler to handle different scenarios based on time. Additionally, if statements are more intuitive and can be easier to debug compared to switch statements.

// Example of using if statements for time-based logic
$currentHour = date('H');

if ($currentHour < 12) {
    echo "Good morning!";
} elseif ($currentHour < 18) {
    echo "Good afternoon!";
} else {
    echo "Good evening!";
}