5 ? 'Yes' : 'No' ) . 'Weekend';"; Finally execute the file."/> 5 ? 'Yes' : 'No' ) . 'Weekend';"; Finally execute the file.">
Home >Backend Development >PHP Problem >How to determine whether a date is a weekend in php
php method to determine whether a date is a weekend: first create a new php file; then enter the code "echo 'today' . date('Y-m-d') . (date('N') >5 ? 'Yes' : 'No') . 'Weekend';"; Finally, just execute the file.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
First, open the php editor and create a new php file. For example: index.php.
In index.php, enter the code: echo 'today' . date('Y-m-d') . (date('N') >5? 'is' : 'is not') . 'weekend';.
The browser runs the index.php page, and the result of determining whether today is a weekend will be printed out.
Recommended study: "PHP Video Tutorial"
The above is the detailed content of How to determine whether a date is a weekend in php. For more information, please follow other related articles on the PHP Chinese website!