Timed in while loop

Asked

Viewed 49 times

-3

Hello

I have a while loop in PHP, I would like to run the loop while 1 time every 20 seconds, has like ?

Thank you

  • tried to use sleep()? or does not solve your problem?

  • 2

    And the words were confusing. You want to run a loop while integer every 20s or each loop iteration should be done at that time?

  • Then I want you to turn the loop while dai stops and wait 20 seconds from that wheel again and so on

2 answers

0

Let this file run on a Cron and seven it to run 20 in 20 seconds

  • Which file ??

  • That your script is in a file. php is not? puts it in your server cron

-2

So solve your problem:

for ($i = 1; $i <= 20; $i++) {
    sleep(20000);
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.