Is it possible to display string on the browser while in infinite loop? This is what I want to happen:
while(1) {
echo "should display these lines on browser while in infinite loop.<br>";
}
Yes, it is possible. You need to flush the output to the browser if you want it to appear immediately:
while(1) {
echo "should display these lines on browser while in infinite loop.<br>";
flush();
}
Chances are that whatever you're trying to accomplish, this isn't how you should go about it.
PHP will eventually time-out, but not before it generates a massive HTML document that your browser will have trouble displaying.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With