How to determine what day of the week today is in php

藏色散人
Release: 2023-03-05 16:14:01
Original
2426 people have browsed it

php method to determine what day of the week today is: first create a PHP sample file; then get today's date through the "$w=date('w');" method; finally use "$week=array( )" method to determine what day of the week today is.

How to determine what day of the week today is in php

Recommendation: "PHP Video Tutorial"

php It is very difficult to determine what day of the week it is today

Simple, as long as you are familiar enough with the php date function, it only takes one sentence! See for yourself below!

Code

<?php
$w=date(&#39;w&#39;);
$week=array(
	"0"=>"星期日",
	"1"=>"星期一",
	"2"=>"星期二",
	"3"=>"星期三",
	"4"=>"星期四",
	"5"=>"星期五",
	"6"=>"星期六"
);
echo &#39;今天是&#39;.$week[$w];
Copy after login

date() function formats the local date and time and returns the formatted date string.

Grammar

date(format,timestamp);
Copy after login

The above is the detailed content of How to determine what day of the week today is in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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
Popular Tutorials
More>
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!