PHP determines what day of the week it is today
php’s date() function is very powerful, and you can use it rationally Various parameters can meet various needs in our daily development. Today I will talk about how to use PHP to determine what day of the week it is today.
PHP date() parameter description
The w parameter is mainly used here. The explanation of this parameter is: w represents the day of the week, and the number represents 0 (meaning Sunday) to 6 (meaning Saturday), with this everything is very simple.
Example:
//php获取今天是星期几 function getWeek($unixTime=''){ $unixTime=is_numeric($unixTime)?$unixTime:time(); $weekarray=array('日','一','二','三','四','五','六'); return '星期'.$weekarray[date('w',$unixTime)]; echo getWeek();
Recommended tutorial:PHP video tutorial
The above is the detailed content of php determine day of week. For more information, please follow other related articles on the PHP Chinese website!