care to elaborate more about it?Cron Job ?
do they need to be declared somehow? integrate time into the script or takes it from the server?if( $date->format( 'H') == 0 && $date->format( 'i') == 0) {
# Reset your variable here
}
<?php
$var = "foobar";
// Some code
print($var);
?>
You can set up a cron job to run once per day at 12am. Check out https://www.cloudways.com/blog/schedule-cron-jobs-in-php/
I... I don't understand what it is you're trying to do.
A variable in PHP is only going to exist for as long as the script is running.
E.G.
PHP:<?php $var = "foobar"; // Some code print($var); ?>
When you call that script $var will only be set to "foobar" until the script finishes. You can't then change the value of it somewhere and it will be a different value.
Even when building plugins in things like Wordpress there is still a script lifecycle. It sounds like you want to be reading something in from your filesystem at midnight every day, or want a script to react differently if it's run on two different days.
Either way, I think your approach is probably wrong.
Will run your script once a day at midnight, which might be exactly what you're after.
cumulative variable and i need to reset it to default for each member at mednight
sorry, yeah its stored in Mysql Database, localhost phpmyadminThat still doesn't answer the question. Where is that variable getting stored? Is it in a database?
sorry, yeah its stored in Mysql Database, localhost phpmyadmin
its food log script calculates calories ate per day, so i need it to reset at 12 midnight