Forum Moderators: coopster

Message Too Old, No Replies

print $variable to browser while script is proccessing

         

erikcw

8:18 pm on Aug 1, 2005 (gmt 0)

10+ Year Member



Hi all,

Can anyone tell me how to print/echo a variable to the browser while the script is still processing?

Example:


$n = 0;
while ($n < 100) {
echo $n;
$n++;
}

If I do this, then all of the data in the loop is presented to the user when the script finishes.

How do I make the script print each variable as soon as it is processed?

Thanks!

sned

9:17 pm on Aug 1, 2005 (gmt 0)

10+ Year Member



You should be able to do this with flush [us3.php.net]

....

$n = 0;
while ($n < 100) {
echo $n;
flush();
$n++;
}

-sned