How does php output New Year's Day? what day is it?
This article mainly introduces how php output New Year's Day is the relevant knowledge of the week, the content is detailed and easy to understand, the operation is simple and fast, with a certain reference value, I believe that everyone after reading this php how to output New Year's Day is what day the article will have a harvest, let's take a look at it.
Output method: 1, define an array containing the week, the element value starts on Sunday; 2, use the "date (" w ", strtotime (" year-1-1 "))" statement to convert the date of New Year's Day into a number that represents the week; 3, use the "echo array name [number]" statement to extract the corresponding week value from the array and output it.
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
What day is the php output New Year's Day?
In PHP, you can use the date () function to determine what day of the week the specified date of New Year's Day is.
Implementation code:
Analyze the code:
Define an array of weeks: array ("day", "one", "two", "three", "four", "five", "six")
Use date () to convert a date to a number that represents the week
Take the number as the subscript and fetch the corresponding week value from the array.
Let's take a look at the calendar and see if the output is correct:
This is the end of the article on "how php outputs what day of the week New Year's Day is". Thank you for reading! I believe you all have a certain understanding of "what day is it that php outputs New Year's Day". If you want to learn more, you are welcome to follow the industry information channel.