Latest web development tutorials

PHP time_nanosleep () function

PHP Misc Reference Manual PHP Misc Reference Manual

Examples

3,5 seconds delay execution of the current script:

<?php
if (time_nanosleep(3,500000000) === true)
{
echo "Slept for three and a half a second";
}
?>

Running instance »

Definition and Usage

time_nanosleep () function delays execution of the current script for several seconds and nanoseconds.


grammar

time_nanosleep( seconds,nanoseconds )

参数 描述
seconds 必需。规定延迟执行脚本的秒数。
nanoseconds 必需。规定延迟执行脚本的纳秒数(必需小于 1,000,000,000)。

technical details

return value: Returns 0 if successful, if it fails to return FALSE.

If the call was interrupted by a signal, it will return the number of seconds remaining in the delay with the delay and the remaining number of nanoseconds associative array.
PHP version: 5+
Update log: Until PHP 5.3.0 version, this function was implemented in the Windows platform.


PHP Misc Reference Manual PHP Misc Reference Manual