How to get week days in php?

后端 未结 7 1535
小鲜肉
小鲜肉 2021-01-22 08:02

I want to get Monday, Tuesday, Wednesday... using php function.

I have only numeric values for those like 1,2,3..7 where

1 = Monday 2 = Tuesday ... 7 = Sunday.<

7条回答
  •  心在旅途
    2021-01-22 08:46

    
    

    So you can create a simple function like this:

    function getDayName($dayNo) {
        return date('l', mktime(0,0,$dayNo,0,1));
    }
    

    Demo: http://www.ideone.com/hrITc

提交回复
热议问题