i would like to execute a script every 2 minutes until i close the window.My script am executing every 2 minutes writes to a file. My script is not writing to the file. please see my interval script.
<?php
$interval = 1; //minutes
set_time_limit (0);
while (true)
{
$now=time ();
echo $now . "<BR>";
sleep ($interval * 1 - (time () - $now));
}
?>
Try
<?php
function do_stuff(){
// do something
sleep(20); // wait 20 seconds
do_stuff(); // call this function again
}
?>