I want to do this:
if (пятница) {//условие}; Ie how to determine the Friday code)
if (5 == date('w')) { drinkVodka(); } if (5 == date('w')) { drinkVodka(); } only until 1:20 pm of the day and in else { //условие еще } How to do this?) - pwnz22getdate returns a structure in which both hours and minutes are, then you can compare it as you like. You can take the time in the form of date('Hi') and compare it with the number 1320 - tutankhamunRoughly speaking:
$daysOfWeek = array('monday' => 1, 'tuesday' => 2, 'wednesday' => 3, 'thursday' => 4, 'friday' => 5, 'saturday' => 6, 'sunday' => 7); if (date('w') == $daysOfWeek['friday']) { // some code } Those. you need to have a variable, or a constant, or a function that will return the day of the week, and then compare the current date with that in the variable / constant / result of the function. And if the condition is true - execute the code.
Source: https://ru.stackoverflow.com/questions/474510/
All Articles