settimeout php code example

Example 1: js settimeout

setTimeout(() => { alert('Hello') }, 1000)

Example 2: timeout php

<?php

set_time_limit(20);

while ($i<=10)
{
        echo "i=$i ";
        sleep(100);
        $i++;
}

?>

Output:
i=0 i=1 i=2 i=3 i=4 i=5 i=6 i=7 i=8 i=9 i=10

Example 3: javascript set timeout

setTimeout(function(){
 	console.log("hello");
}, 3000); //wait for atleast  3 seconds before console logging

Example 4: javascript settimeout

// Redirect to index page after 5 sec
setTimeout(function(){ window.location="index"; },5000);

Tags:

Php Example