PHP time_sleep_until() Function

Definition and Usage

The time_sleep_until() function delays the execution of the code until the specified time.

Syntax

time_sleep_until(timestamp)
Parameters Description
timestamp Required. The timestamp when the script wakes up.

Description

Suspends script execution until the specified timestamp.

Return Value

Returns TRUE on success, FALSE on failure.

Errors/Exceptions

If the timestamp specified is in the past, the function will generate an E_WARNING.

Tips and Comments

Note:All signals will be delivered after the script wakes up.

Note:This function is not implemented on the Windows platform.

Example

<?php
//唤醒10秒后
time_sleep_until(time()+10);
?>