Home >Backend Development >PHP Problem >How to determine what day of the week it is today in php

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

藏色散人
藏色散人Original
2020-08-08 09:27:112735browse

php method to determine the day of the week today: first create a PHP sample file; then use the "date('w');" method to format the date; then define an array of "week"; finally pass "$ week[$w];" just output the judgment result.

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

Recommended: "PHP Video Tutorial"

php How to determine what day of the week it is today?

It’s very simple, as long as you are familiar enough with the php date function, it’s just one sentence!

See for yourself below!

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

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

Statement:
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