What are best practices for handling different pricing based on seasonal dates in a reservation system?

When handling different pricing based on seasonal dates in a reservation system, it is best to use a conditional statement to check the current date against a set of seasonal dates and adjust the pricing accordingly. This can be achieved by creating an array of seasonal dates and corresponding prices, then looping through the array to find the matching seasonal date and retrieve the corresponding price.

// Define array of seasonal dates and corresponding prices
$seasonal_prices = [
    '2022-01-01' => 100,
    '2022-06-01' => 150,
    '2022-09-01' => 120
];

// Get current date
$current_date = date('Y-m-d');

// Check if current date matches any seasonal date
if (array_key_exists($current_date, $seasonal_prices)) {
    $price = $seasonal_prices[$current_date];
    echo "Price for today is: $" . $price;
} else {
    echo "Standard price applies for today.";
}