Need to make PHP ‘stop’… PHP wait timer

AJAX is great… but sometimes it’s too quick if you’re updating… So… How can I make the page wait for a few seconds, then proceed?

Well there are 2 functions PHP has to pause execution. They are:

sleep(NUMBER_OF_SECONDS);

and:

usleep(NUMBER_OF_MS);

One thing you may want to keep in mind is that if you are using a for loop and wish to do this, then you might want to increase the timeout:

set_time_limit(NUMBER_OF_SECONDS);

Leave a Reply


The reCAPTCHA verification period has expired. Please reload the page.