What are common methods for creating a dropdown menu with future years in PHP?

When creating a dropdown menu with future years in PHP, one common method is to use a loop to generate the years dynamically. This can be achieved by getting the current year using the date() function and then looping through a range of years starting from the current year up to a specified number of future years. Each year is then added as an option in the dropdown menu.

<select name="year">
    <?php
    $currentYear = date('Y');
    $futureYears = 5;

    for ($i = 0; $i <= $futureYears; $i++) {
        $year = $currentYear + $i;
        echo "<option value='$year'>$year</option>";
    }
    ?>
</select>