How about the time comparison of Shenma series PHP?
The simplest example is to compare two times using the greater than or less sign. Sometimes when we design a program, we need to control the user to operate a certain function only within a certain time period, and not allowed in other time periods.
For example, I have a website that publishes messages. I publish messages on this website, and then I send them to thousands of users through this message group. According to common practice, once a message is released, it should be immediately sent to thousands of users. In this way, as soon as there is the latest news, users will receive text messages on their mobile phones as soon as possible. However, here comes the problem. For example, if I publish information late at night or early in the morning, I will be XXOOed by all users.
So, time comparison can be used here. If it is published during the day, it will be blocked at night. Let’s assume that the daytime period is from seven in the morning (it is estimated that many people are not awake at seven) to six in the afternoon, then we can do this.
If you want to indicate that checking in between $time1 and $time3 counts as attendance, you can write like this
if($time2>$time1 && $time2<$time3){
echo "Attendance";
}
else{
echo "absence";
}
Of course it can also be written as
if(strtotime($time2)>strtotime($time1) && strtotime($time2)
}
else{
echo "absence";
}
The time can be compared like that, but you wrote the condition wrong, it should be &&, right?
if($time2>$time1 && $time2<$time3){
......