This is probably a silly question but I’ve been all over the internet trying to make this snippet do what I want it to do and just can’t seem to do it. I’m EXTREMELY new to .php and have never used a language that insists on buffering before it outputs.
All I want it to do is write a line, wait a few seconds, then write the next one. My evil plan is to eventually write images (and their links) in to the array and output them to the top of a page. (And I know there are scripts out there that do it, but I’ll never learn by just taking someone else’s script.) In an ideal world, adding the “sleep” function would make it wait 5 seconds before going to the next one, but it still insists on waiting until all have been processed before outputting (making a huge delay in loading the page). So how do I convince this silly language to stop buffering?? I’ve tried the various forms of “flush” in just about every place I can think of, to no avail.
Any help would be appreciated!
//BUILD ARRAY
$array[0]=“This is not a link to test.htm”;
$array[1]=“This is not a link to test1.htm”;
$array[2]=“This is a link to test2.htm”;
$array[3]=“This is a link to test3.htm”;
$array[4]=“This is a link to test4.htm”;
//OUTPUT ITEMS IN ARRAY
for ($x=0; $x<5; $x++)
{
echo "
". $array[$x];
sleep(5); //pause 5 seconds before outputting next item in array
}