PHP sleep() Function
Example
Delay execution of the current script by 5 seconds:
" ; // extend by 5 seconds sleep ( 5 ) ; // output the time again echo date ( ' h:i:s ' ) ; ?>Run Example »
Definition and Usage
The sleep() function delays execution of the current script by a number of seconds.
**Note:** If the specified number of seconds is negative, this function will throw an error.
Syntax
sleep(seconds)
| Parameters | Description |
|---|---|
| seconds | Required. Specifies the number of seconds to delay script execution. |
Technical Details
| Return value: | Returns 0 on success or FALSE on error.
如果调用被信号中断,该函数返回一个非零值。在 Windows 平台上,该值将总是 **192**,表示 Windows API 中的 WAIT_IO_COMPLETION 常量的值。在其他平台上,返回值将是剩余的延迟秒数。 |
| --- | --- | | PHP version: | 4+ | | Changelog: | Prior to PHP 5.3.4, this function always returned NULL when called on Windows platforms. |
PHP Misc Reference Manual