I am trying to implement a simple while-loop on my WAMP server by having a string iterate a certain number of times. However, the entire output occurs at once, despite turning off output buffering in the WAMP PHP settings.
Version 1
$i = 0;
while ($i < 5)
{
print ("This is an example of a while loop.<br/>");
flush();
sleep(1);
$i++;
}
Version 2
$i = 0;
while ($i < 5)
{
print ("This is an example of a while loop.<br/>");
ob_start();
ob_flush();
flush();
sleep(1);
$i++;
}
Neither version outputs the string the way I am intending, namely, one at a time at one second intervals. Any help is greatly appreciated.