I need help to create a script that checks a condition every 1 second for 100 seconds.
Firstly I set max time limit to 101 seconds to make sure I don't time out.
Then I loop it until a condition is met.
When condition is met, run_a_function(); is executed.
I used sleep(1) to make sure the script is ran once a second. I know this might not be the solution to this script.
Please suggest improvement.
Here is the pseudo code:
<?
set_time_limit(101);
for ($time=0; $time<100;$time++ )
{
if ($condition)
{
run_a_function();
break;
}
sleep(1);
}
?>
Any guru please?