getMonths(2019, 2021); foreach($months as $year => $list) { echo "$year
"; echo '
getMonths(2022, 2023); $january2022 = $months[2022][0]; $december2023 = $months[2023][11]; echo "The first month of 2022 is $january2022In this example, we use the getMonths() method to retrieve the list of months for the years 2022 to 2023. We then use array indexing to access specific months from the resulting list, such as the first month of 2022 and the last month of 2023.
"; echo "The last month of 2023 is $december2023"; ?>