PHP time_nanosleep() Function

The time_nanosleep() function delays execution of the current script for a specified number of seconds and nanoseconds.

mixed time_nanosleep ( int $seconds , int $nanoseconds )

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

Example -

ParameterDescription
secondsMust be a non-negative integer.
nanosecondsRequired. Specifies the number of nanoseconds to delay the script (must be less than 1,000,000,000)

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