What are the advantages and disadvantages of dynamically calculating age groups based on a fixed base year in PHP?

When dynamically calculating age groups based on a fixed base year in PHP, the advantage is that the age groups will always be up-to-date without needing manual adjustments. However, the disadvantage is that the age groups may not accurately reflect the intended demographic if the base year is not relevant to the current population.

// Calculate age groups based on a fixed base year
function calculateAgeGroup($birthYear, $baseYear = 2022) {
    $age = $baseYear - $birthYear;
    
    if ($age < 18) {
        return "Under 18";
    } elseif ($age >= 18 && $age < 30) {
        return "18-29";
    } elseif ($age >= 30 && $age < 50) {
        return "30-49";
    } else {
        return "50+";
    }
}

// Example of calculating age group
$birthYear = 1990;
$ageGroup = calculateAgeGroup($birthYear);
echo "Age group: " . $ageGroup;