HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

sleep

Description

The sleep of Miscellaneous for PHP delays execution.

Syntax

sleep(
    int $seconds
): int

Parameters

seconds

Halt time in seconds (must be greater than or equal to 0).

Return

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.

Examples

1 · return

<?

$seconds = 1;

$return = sleep($seconds);

echo $return;
0

2 · seconds

<?

echo date("H:i:s"), PHP_EOL;

$seconds = 1;

sleep($seconds);

echo date("H:i:s");
16:04:55
16:04:56