PHP 5, PHP 7, PHP 8
time_nanosleep - Delay for a number of seconds and nanoseconds
Code Examples

time_nanosleep( int$seconds, int$nanoseconds ): array|bool

Delays program execution for the given number of seconds and nanoseconds.



Must be a non-negative integer.


Must be a non-negative integer less than 1 billion.


On Windows, the system may sleep longer that the given number of nanoseconds, depending on the hardware.

Return Values

Returns true on success or false on failure.

If the delay was interrupted by a signal, an associative array will be returned with the components:

seconds - number of seconds remaining in the delay

nanoseconds - number of nanoseconds remaining in the delay

Related Functions

Example of time_nanosleep

Show all examples for time_nanosleep

PHP Version: