How can a PHP script be written to display multiple game days with corresponding matches in a hierarchical structure?

To display multiple game days with corresponding matches in a hierarchical structure, we can use nested loops to iterate over each game day and its matches. We can organize the data in a multidimensional array where each game day contains an array of matches. Then, we can loop through this data structure to output the game days and their matches in a hierarchical format.

<?php
// Sample data structure with game days and matches
$gameDays = [
    'Day 1' => ['Match 1', 'Match 2'],
    'Day 2' => ['Match 3', 'Match 4'],
    'Day 3' => ['Match 5', 'Match 6']
];

// Loop through game days and matches to display in hierarchical structure
foreach ($gameDays as $day => $matches) {
    echo "<h2>$day</h2>";
    echo "<ul>";
    foreach ($matches as $match) {
        echo "<li>$match</li>";
    }
    echo "</ul>";
}
?>