What is a practical use for PHP's sleep()?

前端 未结 13 2710
时光说笑
时光说笑 2020-12-23 19:17

I just had a look at the docs on sleep().

Where would you use this function?

Is it there to give the CPU a break in an expensive function?

Any common

13条回答
  •  我在风中等你
    2020-12-23 20:04

    A quick pseudo code example of where you may not want to get millions of alert emails for a single event but you want your script to keep running.

      if CheckSystemCPU() > 95  
            SendMeAnEmail()
            sleep(1800)
      fi
    

提交回复
热议问题