Help. Translation of the name of the month from English to Ukrainian: where is the error?

A function to translate the name of the month from English to Ukrainian. Does not work.
None.


Answer 1, authority 100%

$date=normal_date("$row['date']");

Firstly, normal_date() returns NOTHING.
Secondly, remove the double quotes altogether. They are not needed: you are passing a variable. Moreover, they essentially spoil everything, since in this case it would be necessary to write

"$row[date]"

, otherwise an array element with the key QUOTATIONMARKdateQUOTATIONMARK

is passed to the function


Answer 2, authority 50%

Your function doesn’t return anything, it just echoes. This is a mistake.
I think it’s better and more obvious

function normal_date($date){
    $month=array('January'=>'і', 'February'=>'', 'March'=>'');
    return $month[date("F", strtotime($date))];
};

Answer 3, authority 50%

function ukraineMounth()
{
    $date = date("n");
    $mounth = [
        1 => "і",
        2 => "",
        3 => "",
        4 => "і",
        5 => "",
        6 => "",
        7 => "",
        8 => "",
        9 => "",
        10 => "",
        11 => "",
        12 => ""
    ];
    return $mounth[$date];
}

The easiest option..

Leave a reply

Please enter your comment!
Please enter your name here