hisham
IS-IT--Management
- Nov 6, 2000
- 194
How to make a php code is capable of waiting for a given number of seconds before re-run again?
Thanks in Advance.
Thanks in Advance.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
$delay = 10; //seconds
$timeout = 30;//timeout in seconds
$function = 'functionName';//name of function
$force = true;
while ($force){
set_time_limit ($timeout); //reset the timeout counter
sleep ($delay); // wait a while
$function(); // run the function
}
if ($counter == 50){
set_time_limit(120);
sleep(30);
$counter = 0;
} else {
$counter ++;
}