Home >Backend Development >PHP Problem >How to get the current day of the week in php

How to get the current day of the week in php

藏色散人
藏色散人Original
2021-07-15 11:08:304230browse

php method to get the day of the week at the current time: first create a PHP sample file; then output the day of the week through the "echo 'Today is the week:'.$array[$s];" statement.

How to get the current day of the week in php

The operating environment of this article: Windows7 system, PHP7.1 version, DELL G3 computer

How does php get the current day of the week?

PHP code for outputting the current date in Chinese format

PHP output code for the day of the week

<?php
//飞鸟慕鱼博客
$array = array("日","一","二","三","四","五","六");
$s = date(&#39;w&#39;);
echo &#39;今天是周:&#39;.$array[$s];
?>

Code diagram

How to get the current day of the week in php

Code operation results

今天是周:三

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to get the current day of the week 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