Delay execution of the current script for 5 seconds (5000000 nanoseconds):
<?phpecho date('h:i:s') . "<br>";//sleep for 5 secondsusleep(5000000);//start againecho date('h:i:s');?>The usleep() function delays execution of the current script for a number of microseconds (one microsecond equals one millionth of a second).
Note: If the specified number of seconds is negative, this function will throw an error.
usleep( microseconds )
parameter | describe |
---|---|
microseconds | Required. Specifies the number of microseconds to delay script execution. |
Return value: | There is no return value. |
---|---|
PHP version: | 4+ |
Update log: | This function was not implemented under the Windows platform until PHP 5 version. |