How to get the day of the week today is in PHP

Guanhui
Release: 2023-03-01 07:36:01
Original
3900 people have browsed it

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"))];
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!