Is there a latency function in JavaScript? PHP?

Source: Internet
Author: User
That is, the delay of Sleep100c in vb means waiting for 100 milliseconds .. that is, the Sleep 100 in vb.
C's delay
It means waiting for 100 milliseconds ..

Reply content:

Is the Sleep 100 of vb.
C's delay
It means waiting for 100 milliseconds ..

# Jssettimeout ("test ()", "2000"); // run the test () function once in 2000 milliseconds. Setinterval ("test ()", "2000"); // The test () function is executed every 2000 milliseconds and countless times. # Phpsleep ()-delay execution usleep ()-delay execution with a specified number of microseconds

Js

  setTimeout(function(){},1000)

Php

sleep(10);

jsNosleep/delayStrictly speaking, apart from the latency, the two functions willBlockingCurrent thread, and other latenciesAfter thatContinue executing the code

And LS answerssetTimeoutAndsetIntervalAllNot blockedThe current thread only sets a timer in the background.Continue execution immediatelyThe subsequent code will be executed after the timer time is reached

phpUsesleep/usleep, With the same effect as c

Php uses sleep (1); wait 1 second

I flipped through the record of the landlord's questions and advised the landlord to give up the industry early.

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.