PHP Usleep Function
|Time||Time in microseconds|
Definition & Usage
Usleep function is used to pause the execution of PHP script for the $number amount of time, time must be in microseconds. For example, if you want to pause script for 1 second write like that
Note: Usleep function does not return anything.
Example of usleep function
<?php usleep(3000000); echo "Result after three second."; ?>
In the above example, the result will be appeared after 3 second.
More example of usleep function
<?php echo "Start time:"; echo date('h:i:s') . "
"; usleep(4000000); echo "End time:"; echo date('h:i:s'); ?>
In the above example, You can see the start and end time of the script and the difference between both times is 4 second.