What is the best approach to dynamically display multiple time entries under a specific date in PHP?

To dynamically display multiple time entries under a specific date in PHP, you can use an associative array where the keys are the dates and the values are arrays of time entries. You can then loop through this array to display the time entries for a specific date.

// Sample time entries data
$timeEntries = array(
    '2022-01-01' => array('10:00 AM', '2:00 PM'),
    '2022-01-02' => array('9:00 AM', '1:00 PM', '3:00 PM'),
);

// Date to display time entries for
$dateToDisplay = '2022-01-02';

// Display time entries for the specified date
if (array_key_exists($dateToDisplay, $timeEntries)) {
    foreach ($timeEntries[$dateToDisplay] as $time) {
        echo $time . "<br>";
    }
} else {
    echo "No time entries found for the specified date.";
}