Page 1 of 1

how to show script output while running (ob_flush stuff)

Posted: Wed Feb 08, 2006 7:48 am
by jmut
Ok
I am really having problem with this stuff :(

I want to display echos for example while running an foreach.
having sleep for example to actually see that the flush is working.
10x

Code: Select all

ob_start();

echo "Hello ";

$out1 = ob_get_contents();
sleep(2);
echo "World";

$out2 = ob_get_contents();

ob_end_clean();

var_dump($out1, $out2);
how could I make this script show me "Hello"
and after 2 seconds "World".


Thanks a lot

Posted: Wed Feb 08, 2006 8:27 am
by Benjamin

Posted: Wed Feb 08, 2006 9:09 am
by feyd
I word to the wise: some servers, or server settings, may affect your output buffering. flush() and ob_flush() may work just fine on the php side, but it still may be buffered on the actual server's side.