PHP: get output before script completes

I have a script named data.php that looks like this:

/* do some stuff */
echo $result;
/* do some other stuff (eg database operations) */

I need to use the output of data.php in another script, but I do not want the calling script to wait for data.php to complete.

What is the easiest way to do this?

Thanks in advance!

+5
source share
2 answers

Take a look at the flush () function: http://php.net/manual/en/function.flush.php

+7
source

Theoretically speaking (writing down), one script should output to the stream, and the other should read from the same stream.
A good (and simple) example would be one file that is written to a file in HD, and the other from it. The simplest, but not the best.

+1
source

All Articles