View Full Version : Outputting and ending buffer early

06-18-2010, 06:34 PM
I would like a php script to submit it's output to the browser and continue to run code. For example:

echo "This is my output";
ob_end_flush(); //The browser has completely loaded the page
//work goes here

With the above script, from the browser's point of view, the page will have loaded instantly with the words "This is my output" and not for 100 seconds. The script however will continue to run code without any dependence on the browser's connection.

ob_end_flush() did not work as I wanted it to, I don't know if that's even it's intended purpose. How can I go about doing this?

06-19-2010, 10:26 AM
Look at the responses at PHP's documentation page on the sleep page: http://php.net/manual/en/function.sleep.php. From what I can infer it is browser dependent and can have problems with flushing output.