PHP sleep() Function
Definition and Usage
The sleep() function delays the execution of the code for several seconds.
Syntax
sleep(seconds)
Parameter | Description |
---|---|
seconds | Required. The pause time in seconds. |
Return Value
If successful, returns 0, otherwise returns false.
Error/Exception
If the specified description seconds If negative, the function will generate an E_WARNING.
Example
<?php echo date('h:i:s') . "<br "/>; //Pause for 10 seconds sleep(10); //Restart echo date('h:i:s'); ?>
Output:
12:00:08 12:00:18