setTimeout en setInterval bruikbare functies van Javascript samen met de sleep/usleep functie van php om tijdintervallen te zetten

setTimeout(function(){ alert("Hello"); }, 3000);

The setTimeout() method calls a function or evaluates an expression after a specified number of milliseconds.
1000 ms = 1 second.
The function is only executed once. If you need to repeat execution, use the setInterval() method.
Use the clearTimeout() method to prevent the function from running.

var myVar;

function myFunction() {
  myVar = setInterval(alertFunc, 3000);

function alertFunc() {

En de php variant

// current time
echo date('h:i:s') . "\n";
// sleep for 10 seconds
// wake up !
echo date('h:i:s') . "\n";