function func(){
console.log("Ran")
}
setInterval(func,1000)//Runs the "func" function every second
function setInterval($f, $milliseconds)
{
$seconds=(int)$milliseconds/1000;
while(true)
{
$f();
sleep($seconds);
}
}