Rustywolf Posted March 13, 2010 Share Posted March 13, 2010 I found another topic about this but the solution was using the meta tag instead of sleep and header to reidrect my code is <?php function slowecho($input) { $input_letters = str_split($input); for($i = 0; $i <= count($input_letters); $i++) { echo $input_letters[$i]; //Wont echo. till its gone through loop every time. sleep(1); } } if($_GET['str']) { slowecho($_GET['str']); } ?> Any help? Link to comment https://forums.phpfreaks.com/topic/195092-sleep-stopping-echo/ Share on other sites More sharing options...
teamatomic Posted March 13, 2010 Share Posted March 13, 2010 Here is an example for you to figure out what you need to do. for($i=0;$i<50;$i++) { ob_start(); echo "$i<br>"; flush(); ob_end_flush(); sleep(1); } HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/195092-sleep-stopping-echo/#findComment-1025519 Share on other sites More sharing options...
Rustywolf Posted March 13, 2010 Author Share Posted March 13, 2010 Sweet. Although , care to expain a bit i get their uses (thanks to php.net) But not why it works... Link to comment https://forums.phpfreaks.com/topic/195092-sleep-stopping-echo/#findComment-1025528 Share on other sites More sharing options...
teamatomic Posted March 13, 2010 Share Posted March 13, 2010 It works because it uses the buffer to hold output then it is flushed to the screen. The script then sleeps>buffers>flushes all over again...and again...and again... HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/195092-sleep-stopping-echo/#findComment-1025533 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.