Why does my php while loop block output

时间:2016-07-11 22:01:46

标签: php

I have php code like this:

<?php

While (1)echo "hello";

The server is outputing a chunk of data instead of progressively outputting each 'hello'

1 个答案:

答案 0 :(得分:4)

By default, PHP output is not sent to the browser while the script executes. Nothing gets sent to the browser until the script finishes. Since your loop never ends, the script never exits, so nothing shows in the browser.