Home >Backend Development >PHP Problem >How to determine what day of the week today is in php
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.
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('w'); $week=array( "0"=>"星期日", "1"=>"星期一", "2"=>"星期二", "3"=>"星期三", "4"=>"星期四", "5"=>"星期五", "6"=>"星期六" ); echo '今天是'.$week[$w];
date() function formats the local date and time and returns the formatted date string.
Grammar
date(format,timestamp);
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!