PHP: Succint and scalable function to get what financial year we are in
Ways of improving:

According to information provided the crucial function's purpose is "to return a particular menu number for the current year". Thus, the function name would be more descriptive with name getFinYearMenuNumber.

The preconditions are:


your financial year flows through "April to April" month periods
there's starting year 2019 and ending year 2015 for the whole interval.To make the function more unified those boundaries could be passed as input parameters:

function getFinYearMenuNumber($yearFrom, $yearTo)



The main issue of the current approach is that it'll inevitably perform 5 excessive if checks (they could be at least mutually exclusive if ... else if ... else if ...).

Instead, we can just perform 2 subsequent checks: 


if the current year falls in the needed interval
if the current month is following or preceding the starting month (April)




The final version:

function getFinYearMenuNumber($yearFrom, $yearTo) {
    $curr_month = (int) date('m');    # current month number
    $curr_year = (int) date('Y');     # current year
    $curr_date = new DateTime();

    if ((new DateTime("$yearFrom-04")) &lt;= $curr_date &amp;&amp; $curr_date &lt;= (new DateTime("$yearTo-04"))) {
        if ($curr_month &gt; 3) {
            return $curr_year - $yearFrom + 1; 
        } else if ($curr_month &lt; 4) {
            return $curr_year - $yearFrom; 
        }
    }

    return 0;
}

print_r(getFinYearMenuNumber(2019, 2025));