How can the PHP script be adjusted to display only upcoming shows based on the current date and time, filtering out past events?

To display only upcoming shows based on the current date and time, we need to filter out past events by comparing the event date with the current date. We can achieve this by using the PHP `strtotime()` function to convert the event date to a timestamp and then comparing it with the current timestamp obtained using `time()`. By filtering out events where the event date is greater than the current date, we can display only upcoming shows.

<?php
$current_date = time(); // Get the current timestamp
$shows = array(
    array('name' => 'Show 1', 'date' => '2022-12-01 18:00:00'),
    array('name' => 'Show 2', 'date' => '2022-12-05 20:00:00'),
    array('name' => 'Show 3', 'date' => '2022-11-25 15:30:00'),
);

foreach ($shows as $show) {
    $event_date = strtotime($show['date']); // Convert event date to timestamp
    if ($event_date > $current_date) {
        echo $show['name'] . ' - ' . $show['date'] . '<br>'; // Display upcoming shows
    }
}
?>