Date in Russian

Clause{Article} has got to me nobody Andrey Kuharchika: " It is programmed on RNR ". In her has been written zanjatnyj a script of a conclusion of date in Russian. But very big, in my opinion, he was.


That script:



// - we determine a file for months-

$q [] = " ";

$q [] = "January";

$q [] = "February";

$q [] = "March";

$q [] = "April";

$q [] = "May";

$q [] = "June";

$q [] = "July";

$q [] = "August";

$q [] = "September";

$q [] = "October";

$q [] = "November";

$q [] = "December";

// - we determine a file for days of week-

$e [0] = "Sunday";

$e [1] = "Monday";

$e [2] = "Tuesday";

$e [3] = "environment{Wednesday}";

$e [4] = "Thursday";

$e [5] = "Friday";

$e [6] = "Saturday";

//----we read - out month

$m=date ('m');

if ($m == "01") $m=1;

if ($m == "02") $m=2;

if ($m == "03") $m=3;

if ($m == "04") $m=4;

if ($m == "05") $m=5;

if ($m == "06") $m=6;

if ($m == "07") $m=7;

if ($m == "08") $m=8;

if ($m == "09") $m=9;

//----we read - out day of week

$we=date ('w');

//----we read - out number

$chislo=date ('d');

// - it is taken from day of week

$den_nedeli = $e [$we];

// - we take value of month

$mesyac = $q [$m];

echo "Today". $chislo. " ". $mesyac. ",". $den_nedeli;


See what he big, bulky. I have decided to get rid of a superfluous code and to write function of a conclusion of date in Russian


For this purpose I have cleaned{removed} numerous comparisons and data input in a file. In result at me that has turned out:



function gws_daterus () {

// - we determine a file for months--

$mounth=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"

);


// - we determine a file for days of week-

$week=array (

Sunday, Monday, Tuesday, environment{Wednesday},

Thursday, Friday, Saturday,

);

$date_m=strtr (date ('m'), $mounth);

$date_w = $ week [date ('w')];

$date_d=date ('m');

return $date_d. " ". $date_m. ",". $date_w;

}


In my opinion, my variant more beautiful. For speed of performance I did not check,

But I think speed of performance of a script should increase