PHP usleep()Functions

PHP Misc 参考手册PHP Misc Reference Manual

Examples

Delay execution of the current script by 5 seconds (5000000 microseconds):

<?php echo date('h:i:s') . "<br>"; //sleep for 5 seconds usleep(5000000); //start again echo date('h:i:s'); ?>

Run Example »

Definition and Usage

The usleep() function delays execution of the current script by a number of microseconds (one microsecond equals one millionth of a second).

Note:If the specified number of seconds is negative, the function will throw an error.


Syntax

usleep(microseconds)

Parameters Description
microseconds Required. Specifies the number of microseconds to delay the script execution.

Technical Details

Return value: No return value.
PHP Version: 4+
Changelog: This function was not implemented on Windows platforms until PHP 5.


PHP Misc 参考手册PHP Misc Reference Manual

Other Extensions