Is it possible to echo each time the loop is executed? For example:
foreach(range(1,9) as $n){
echo $n."\n";
sleep(1);
}
Instead of printing everything when the loop is finished, I'd like to see it printing each result per time.
Is it possible to echo each time the loop is executed? For example:
foreach(range(1,9) as $n){
echo $n."\n";
sleep(1);
}
Instead of printing everything when the loop is finished, I'd like to see it printing each result per time.
I didn't want to have to turn off gzip for the whole server or a whole directory, just for a few scripts, in a few specific cases.
All you need is this before anything is echo'ed:
Then do the flush as normal:
Nginx seems to pick up on the encoding having been turned off and doesn't gzip.
You can accomplish this by flushing the output buffer in the middle of the loop.
Example:
Note that your php.ini settings can affect whether this will work or not if you have zlib compression turned on