PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
shawngoldw
Forum Contributor
Posts: 212 Joined: Mon Apr 05, 2010 3:38 pm
Post
by shawngoldw » Fri Aug 06, 2010 5:36 pm
Very simply, I can not get flush to work. I'm using this code:
Code: Select all
for ($i=0; $i < 3; $i++)
{
echo $i;
flush();
sleep(1);
}
I've tried with ob_flush() too but can't get that working. I know that the server is set up to allow it because if I run this:
Code: Select all
phpinfo();
for ($i=0; $i < 3; $i++)
{
echo $i;
flush();
sleep(1);
}
phpinfo flushes and then my loop does not. How do I use flush properly?
Thank you,
Shawn
JakeJ
Forum Regular
Posts: 675 Joined: Thu Dec 10, 2009 6:27 pm
Post
by JakeJ » Fri Aug 06, 2010 6:02 pm
shawngoldw wrote: How do I use flush properly?
Sometimes you have to hold the handle down until all the water is gone.
Hey! It's Friday night! What do you want from me? Sanity and clear thinking?
shawngoldw
Forum Contributor
Posts: 212 Joined: Mon Apr 05, 2010 3:38 pm
Post
by shawngoldw » Fri Aug 06, 2010 7:12 pm
JakeJ wrote: shawngoldw wrote: How do I use flush properly?
Sometimes you have to hold the handle down until all the water is gone.
Hey! It's Friday night! What do you want from me? Sanity and clear thinking?
haha, too bad I'm stuck in a university town during exams!
It seems that adding
before flush makes it work....
Whaaa?
McInfo
DevNet Resident
Posts: 1532 Joined: Wed Apr 01, 2009 1:31 pm
Post
by McInfo » Sat Aug 07, 2010 9:40 am
Read the description for
flush() . One or more of the situations described may apply to you.
shawngoldw
Forum Contributor
Posts: 212 Joined: Mon Apr 05, 2010 3:38 pm
Post
by shawngoldw » Sat Aug 07, 2010 11:32 am
Thanks, I've read through a lot of that already, thats how I got it to work with the pad. I think it has to do with the output_buffer which is set to 4096 bytes. I'll work it out