Brad Bonkoski wrote:


cajbecu wrote:

Hello,

   for ($i=0; $i < 10; $i++) {
       $output = "ccc2";
       print "<pre>";
       echo $output;
       print "</pre>";
       ob_flush();
       flush();

       sleep(1);
   }

I want to show on the browser, "ccc2" (example) every 1 second, but it
shows all the text when the for stops... any ideea?

i tried all the examples from php.net, all the examples on the net,
bot no succes.

cheers,

PHP is a server side scripting language, so the information would not be sent to the browser( aka client) until the server side script has completed its execution.
-Brad

That is incorrect. There is nothing stopping a PHP script from doing exactly what he says, and being a server-side script doesn't imply that the data will be buffered.

I suggest that both of you examine the contents of http://www.php.net/manual/en/function.flush.php for more information on obstacles to getting data to the client as it is generated.

As an unrelated note, there is no point in using "print" for some things and "echo" for others. For your uses, you might as well just use "echo" for everything.

Regards, Adam Zey.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to