Home>Article>Backend Development> How to get the day of the week today is in PHP
How to get the day of the week today in PHP
In PHP, you can use the function "date()" to get the day of the week today. This function Its function is to format a local time or date. When using it, just pass the first parameter into the string "w", which means to get the day of the week. If the return value is 0, it means Sunday.
Sample code:
$weekarray=array("日","一","二","三","四","五","六"); //先定义一个数组 echo "星期".$weekarray[date("w")]; //获取指定日期 $weekarray=array("日","一","二","三","四","五","六"); echo "星期".$weekarray[date("w",strtotime("2011-11-11"))];
Recommended tutorial: "PHP Tutorial"
The above is the detailed content of How to get the day of the week today is in PHP. For more information, please follow other related articles on the PHP Chinese website!