PHP tutorial, explained to use sleep and usleep function in PHP. Sleep is very common method in every language. How sleep function works we need to understand.
use sleep and usleep function in PHP
Sleep function delays the program execution for the given number of seconds.
Usleep delays program execution for the given number of micro seconds.
Following is the php example with sleep function
<?php echo date('h:i:s') . "<br />"; //stop execution for 30 seconds sleep(30); //start again echo date('h:i:s'); ?&gt;
Following is the php example with usleep function
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php echo date('h:i:s') . "<br />"; //stop execution for 30 seconds usleep(30000000); //start again echo date('h:i:s'); ?>