sleep
Function • Params and return types changed in PHP 8.0
Delay execution.
sleep Function synopsis
sleep(int $seconds): int
Parameters
$seconds
Typeint
Halt time in seconds (must be greater than or equal to 0).
Return value
Typeint
Returns zero on success.
If the call was interrupted by a signal, sleep returns
a non-zero value. On Windows, this value will always be
192 (the value of the
WAIT_IO_COMPLETION constant within the Windows API).
On other platforms, the return value will be the number of seconds left to
sleep.
Changes to the sleep Function
PHP 8.0
- Return type added:
int - Parameter type added for parameter #1 (
$seconds):int
- sleep($seconds)
+ sleep(int $seconds): int sleep Function Availability
sleep Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Upcoming Release | Yes |
| PHP 8.5Supported (Latest) | Yes |
| PHP 8.4Supported | Yes |
| PHP 8.3Security-Fixes Only | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Unsupported | Yes |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | Yes |
| PHP 7.0Unsupported | Yes |
| PHP 5.6Unsupported | Yes |
| PHP 5.5Unsupported | Yes |
| PHP 5.4Unsupported | Yes |
| PHP 5.3Unsupported | Yes |