PHP implementation today is the day of the week

Source: Internet
Author: User
Today is the day of the week in many ways, this article has compiled three commonly used, interested friends can understand The code is as follows:
// Method 1
$ Da = date ("w ");
If ($ da = "1 "){
Echo "Today is Monday ";
} Else if ($ da = "2 "){
Echo "Today is Tuesday ";
} Else if ($ da = "3 "){
Echo "Today is Wednesday ";
} Else if ($ da = "4 "){
Echo "Today is Thursday ";
} Else if ($ da = "5 "){
Echo "Today is Friday ";
} Else if ($ da = "6 "){
Echo "Today is Saturday ";
} Else if ($ da = "0 "){
Echo "Today is Sunday ";
} Else {
Echo "Your input is incorrect !! ";
};
// Method 2
$ Ga = date ("w ");
Switch ($ ga ){
Case 1: echo "Today is Monday"; break;
Case 2: echo "Today is Tuesday"; break;
Case 3: echo "Today is Wednesday"; break;
Case 4: echo "Today is Thursday"; break;
Case 5: echo "Today is Friday"; break;
Case 6: echo "Today is Saturday"; break;
Case 0: echo "Today is Sunday"; break;
Default: echo "Your input is incorrect! ";
};
// Method 3

Echo "today is the week". mb_substr ("May 25, 1234", date ("w"), 1, "UTF-8 ");

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.