I need run script from Windows WAMP server. It should work like this:
<?php
while(1){
echo 'Start<br>';
//Some magic here to wait 5 seconds
echo 'End<br>';
}
?>
What I want is automatic work: print out Start
-> wait 5 seconds -> print out End
-> print out Start
-> wait 5 seconds -> ....
In php, Sleep(5);
is not an option because (as far as I can tell) it will wait for end of program and after that it will output Start
and End
.
I cannot use Windows Task Scheduler
, because in future, script will run at linux server. But I cannot work with cron because I am on windows. So, basically I need something like cron, but in php on windows and wamp localhost.
So, my question is: Is there any option in php/javascript/whatever how to iterate one script 'live' with pause?
PYTHON EXAMPLE:
import time
for i in range(10):
print('Start')
time.sleep(5)
print('End')
Thank you for every advice!