Asheeown Posted August 3, 2009 Share Posted August 3, 2009 ob_start(); for($i=0; $i < 10; $i++) { echo $i . ' '; ob_flush(); flush(); sleep(1); } Does not output 0 1 2 3 4 5 6 7 8 9 incrementally it waits till the script is done loading and then displays it. Anyone know if I'm doing something wrong, I have done this before but I can't figure it out. Link to comment https://forums.phpfreaks.com/topic/168703-solved-output-buffering-problem/ Share on other sites More sharing options...
gevans Posted August 3, 2009 Share Posted August 3, 2009 This isn't something you can do with php. It's a server side script, it will run that script as you've written it, then output everything at the same time. Link to comment https://forums.phpfreaks.com/topic/168703-solved-output-buffering-problem/#findComment-890025 Share on other sites More sharing options...
Asheeown Posted August 3, 2009 Author Share Posted August 3, 2009 That's not true, as I've said I have done this before. As information is released into the buffer it will push it into display. Link to comment https://forums.phpfreaks.com/topic/168703-solved-output-buffering-problem/#findComment-890026 Share on other sites More sharing options...
gevans Posted August 3, 2009 Share Posted August 3, 2009 That's not true OK Link to comment https://forums.phpfreaks.com/topic/168703-solved-output-buffering-problem/#findComment-890028 Share on other sites More sharing options...
Asheeown Posted August 3, 2009 Author Share Posted August 3, 2009 This isn't something you can do with php. Oh really, then try this out if (ob_get_level() == 0) ob_start(); for($i=0; $i < 10; $i++) { echo $i . ' '; ob_flush(); flush(); sleep(1); } ob_end_flush(); Thanks for not helping btw. Link to comment https://forums.phpfreaks.com/topic/168703-solved-output-buffering-problem/#findComment-890053 Share on other sites More sharing options...
gevans Posted August 3, 2009 Share Posted August 3, 2009 holly crap, i take back everything I said, I really didn't know php could do that. Link to comment https://forums.phpfreaks.com/topic/168703-solved-output-buffering-problem/#findComment-890055 Share on other sites More sharing options...
TeNDoLLA Posted August 3, 2009 Share Posted August 3, 2009 For what you are exactly using this (just for curiosity)? Link to comment https://forums.phpfreaks.com/topic/168703-solved-output-buffering-problem/#findComment-890064 Share on other sites More sharing options...
Asheeown Posted August 3, 2009 Author Share Posted August 3, 2009 I'm writing a linux shared hosting server migration tool. I want it to look nice and display all results instantaneously. Plus it's part of a new thing I'm doing where my web apps are more like actual applications. Link to comment https://forums.phpfreaks.com/topic/168703-solved-output-buffering-problem/#findComment-890096 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.