Basically I want to loop through and open a new url in each iFrame, but between each iFrame there must be a 2.2 second delay. But it's not doing that, what it's doing is delaying, then loading all of the iFrames at once. Any suggestions? <?php $url = "www.site.com/id="; $id = 100000005; $delay = 2.2; $x = 5; while($x > 0) { Sleep($delay); echo '<iframe name="FRAMENAME" src="'.$url . $id.'" width="100" height="280" style="border: 10 solid #0415FB" scrolling="no" allowautotransparency=true></iframe>'; $x--; $friendid++; } ?> Code (markup): Thanks!
You need to flush PHP's output buffers after each iteration to get the effect you desire. <?php $delay = 1; // max number of iterations $it = 10; while($it > 0) { echo $it; flush(); sleep($delay); $it--; } ?> PHP: Tested on Centos4/PHP5. If that does not work for you try <?php $delay = 1; // max number of iterations $it = 10; while($it > 0) { echo $it; ob_flush(); flush(); sleep($delay); $it--; } ?> PHP: