I need a help with logic, but, I can not mount it in PHP (well, I do not want to use this process with mysqli). In the following example, it would be the problem I face, basically.
$hoje = date("Y-m-d"); // Retorna data atual (2018-03-15) formato americano
$inicio_evento = $row['inicio']; // Retorna data 2018-03-15
$fim_evento = $row['fim']; // Retorna data 2018-03-20
As I mentioned above, what I need to heal in relation to logic is ... If today's date is between dates $inicio_evento
and $fim_evento
, then the value is true
.
The problem is this logic that I can not mount (with IF / ELSE), and I think maybe it's because I'm confusing Comparison Operators.
if(strtotime($inicio_evento) == strtotime($hoje) OR strtotime($fim_evento) >= strtotime($hoje)) {
// CODE
}
Can someone give me a hand?