What is the best way to store and access multiple variables in PHP for a dynamic website feature like an Advent calendar?

To store and access multiple variables for an Advent calendar feature in PHP, you can use an associative array where the keys represent the dates and the values represent the corresponding content or gifts. This way, you can easily retrieve the content for a specific date by accessing the array with the date as the key.

// Define an associative array with dates as keys and content as values
$adventCalendar = [
    '2021-12-01' => 'Gift 1',
    '2021-12-02' => 'Gift 2',
    // Add more entries for each date
];

// Access the content for a specific date
$date = '2021-12-01';
$content = $adventCalendar[$date];

echo $content; // Output: Gift 1