I do it, but it does not work. What is the problem?

$day[0] = "Воскресенье"; $day[1] = "Понедельник"; $day[2] = "Вторник"; $day[3] = "Среда"; $day[4] = "Четверг"; $day[5] = "Пятница"; $day[6] = "Суббота"; $time = '2015-01-01'; $dnum = date("w", $time); $textday = $day[$dnum]; echo $textday; 
  • one
    add echo $dnum; - Igor
  • @Igor but then the ordinal number of the day of the week is displayed - bakusite
  • one
    $dnum = intval(date("w", $time)); - Igor

1 answer 1

 $day[0] = "Воскресенье"; $day[1] = "Понедельник"; $day[2] = "Вторник"; $day[3] = "Среда"; $day[4] = "Четверг"; $day[5] = "Пятница"; $day[6] = "Суббота"; $time = '2015-01-01'; $dnum = date("w",strtotime($time)); $textday = $day[$dnum]; echo $textday; 

http://php.net/manual/ru/function.date.php date timestamp accepts rather than a string.

  • PSR-2. The argument list MUST NOT be a space before the commas, but there MUST be a space after each comma. - rjhdby