setinterval in php code example
Example 1: jquery call function every second
setInterval(function(){
//this code runs every second
}, 1000);
Example 2: js setinterval
function func(){
console.log("Ran")
}
setInterval(func,1000)//Runs the "func" function every second
Example 3: setinterval php
setInterval(function(){
echo "hi!\n";
}, 1000);
Example 4: setinterval php
function setInterval($f, $milliseconds)
{
$seconds=(int)$milliseconds/1000;
while(true)
{
$f();
sleep($seconds);
}
}