PHP function sleep()

Availability in PHP 4.0

Script sleep.

Parameters

Parameter Data type Default value Note
$seconds int not How long to sleep in seconds.

Return values

int

Returns zero (0) if correct, or false if incorrect.

If the sleep was artificially interrupted, it returns the number of seconds missing until the end of the sleep.

php
echo 'Hello!'; // Printed immediately
sleep(3); // Script will be paused for 3 seconds
echo 'How are you?'; // Printed after 3 seconds

Newsletter

Nejlepsi tipy a triky o PHP do Vaseho e-mailu. Clanky a novinky nejen ze sveta PHP a programovani.