like this, but I can't find a solution

if ($dayname == 'monday') { echo $worktim_monday; } elseif ($dayname == 'sunday') { echo $worktime_sunday; } 

but how to display the name of the day of the week in the $ dayname variable at the moment?

2 answers 2

 $dayname = date('l'); 

More details about the date () function .

Shl. However, the word returns with a capital letter. For example Monday.

     $worktime = [ '效邪褋褘 褉邪斜芯褌褘: Sunday', // 胁芯褋泻褉械褋械薪褜械! '效邪褋褘 褉邪斜芯褌褘: Monday', '效邪褋褘 褉邪斜芯褌褘: Tuesday', '效邪褋褘 褉邪斜芯褌褘: Wednesday', '效邪褋褘 褉邪斜芯褌褘: Thursday', '效邪褋褘 褉邪斜芯褌褘: Friday', '效邪褋褘 褉邪斜芯褌褘: Saturday' ]; echo $worktime[date('w')];