<?php if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
function get_current_time()
{
    $date = new DateTime('now', new DateTimeZone('Asia/Dhaka'));
    $current_time = $date->format('Y-m-d H:i') . "\n";
    return $current_time;
}

function get_current_date()
{
    $date = new DateTime('now', new DateTimeZone('Asia/Dhaka'));
    $current_date = $date->format('d-m-Y') . "\n";
    return $current_date;
}

// Get Dynamic Month Name
function get_all_month()
{
    $months = array(
        '01' => 'January',
        '02' => 'February',
        '03' => 'March',
        '04' => 'April',
        '05' => 'May',
        '06' => 'June',
        '07' => 'July ',
        '08' => 'August',
        '09' => 'September',
        '10' => 'October',
        '11' => 'November',
        '12' => 'December',
    );
    return $months;
}

// Dynamic Year - current year to previous year 
function get_all_year()
{
    $now = new DateTime();
    $year = $now->format("Y");
    $allYear = [];
    for ($i = 2010; $i <= $year; $i++) {
        array_push($allYear, $i);
    }
    $reverse = array_reverse($allYear, true);
    return $reverse;
}


// Number to month name
function number_to_month_name($number)
{
    $monthNumber = $number;
    $monthName = date("F", mktime(0, 0, 0, $monthNumber, 10));
    return $monthName . ',' . ' ';
}




// Dynamic Year - current year to previous year
function current_year_to_previous_year()
{
    $currentYear = date("Y");

    for ($x = $currentYear; $x <= $currentYear; --$x) {
        if ($x == 2000) {
            break;
        }
        echo "The number is: $x <br>";
    }
}
