I have an IF statement that'll only run when I reload the page. Here's the code:
if ($date == date('00:00:00') && (isset($postchecktoday))){
// Code goes here
}
The if statement is within a function that runs constantly. When it hits 00:00:00, I have to reload the page dead-on that time so that the if statement actually runs. I basically want the if statement to run by itself without having to reload the page at 00:00:00.
The whole point of it running precisely at 00:00:00 is so that it only runs the IF statement once every 24 hours.
Is there an alternative way of doing this using strictly PHP? I would use a CRON but wouldn't that execute the whole PHP file once a day? At the moment I have a function that's constantly running with code, and an if statement within that function which only runs at 00:00:00. Unless the CRON is able to directly call that IF statement from the PHP file, I'm unsure if that is any use to me.