My Aim: I want to have a string (say "PHP") to be keep displaying on the screen after every 5 seconds for 10 times.
I am using the following code:
<?php
for($i=1;$i<=10;$i++)
{
sleep(5);
echo 'PHP<br>';
}
?>
But, what the above code does is - the script waits for 50 seconds, and "PHP" is displayed 10 times on the screen instantly. Although, the script should first wait for 5 seconds and then display "PHP"... then again wait for 5 seconds and display "PHP"..... and so on.... for 10 times.
Does anyone know where the problem is? It will be really appeciated 🙂