PHP pause function The difference between sleep () and Usleep ()

Source: Internet
Author: User
Tags usleep

Pause code Execution in PHP for a certain time, there are two functions can be implemented, one is sleep (), the other is usleep (), their parameters are an integer value. Sleep () is how many seconds are paused, and usleep () is how many microseconds are paused.

Note:the usleep () unit is in microseconds, 1 seconds = 1000 milliseconds, 1 milliseconds = 1000 microseconds, or 1 microseconds equals one out of 10,000 seconds.

If you want to use only usleep () in your program to pause the number of milliseconds, be sure to pay attention to the units of the parameter, assuming that you pause for 50 milliseconds, you should use Usleep (50000)instead of Usleep (50).

In addition, this pause can not be hundred percent accurate, with the system scheduling, CPU clock cycle and so on have a certain relationship.

PHP pause function The difference between sleep () and Usleep ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.