P. Avery
P. Avery

Reputation: 809

Why does my php while loop block output

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'

Upvotes: 0

Views: 62

Answers (1)

Barmar
Barmar

Reputation: 781721

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.

Upvotes: 4

Related Questions