PHP - sleep
Trieda
Metóda - sleep
(PHP 4, PHP 5, PHP 7)
The sleep() function stops the script for a given number of
seconds.
If it's needed to stop the script for microseconds, the usleep()
function can be used.
Procedurálne
- function sleep (int $seconds) : int
Parametre
| Názov | Dátový typ | Predvolená hodnota | Popis |
|---|---|---|---|
| $seconds | int | The number of seconds to delay the script. |
Mávratovej hodnoty
Vracia: int
Returns 0 on success, false on an error.
If the function was interrupted by a signal, returns 192 on
Windows (the value of the WAIT_IO_COMPLETION constant) and on
other operating systems return the number of seconds which left.
Príklady
<?php
echo date('H:i:s');
echo ' - falling asleep...<br />';
sleep(5);
echo 'I am awake! It is ';
echo date('H:i:s');
Súvisiace manuály
- function set_time_limit (int $seconds) : bool
- function usleep (int $micro_seconds) : void
