Delay execution of current script for 3,5 seconds:
<?phpif (time_nanosleep(3,500000000) === true) { echo "Slept for three and a half a second"; }?>The time_nanosleep() function delays execution of the current script for a number of seconds and nanoseconds.
time_nanosleep( seconds, nanoseconds )
parameter | describe |
---|---|
seconds | Required. Specifies the number of seconds to delay script execution. |
nanoseconds | Required. Specifies the number of nanoseconds to delay script execution (must be less than 1,000,000,000). |
Return value: | Returns 0 if successful and FALSE if failed. If the call is interrupted by a signal, an associative array with the number of seconds remaining in the delay and the number of nanoseconds remaining in the delay is returned. |
---|---|
PHP version: | 5+ |
Update log: | This function was not implemented under the Windows platform until PHP 5.3.0 version. |