I have a PHP file with the following contents:
1. <?php
2. $string = 'Hello world!';
3. echo $string;
4. ?>
I put a break on line 2 and line 4. I run the debugger. The browser output opens, the script has halted on line 2, and the browser output is empty. Makes sense! Then I jump to the next breakpoint at line 4, after the echo command. AT THIS POINT, should the browser update and display 'Hello world'? Or do debuggers not update the browser output step-by-step, and thus are NOT useful for browser display and are only useful for inspecting the inner-code itself?
Thank you!
The answer is a bit complicated here. In general, Xdebug will not stop output to the browser, and PHP will not do so either unless you have output buffering or automatic compression turned on.
However, the web server might buffer data up to a certain point before it sends it onwards to the browser. You can force the web server to flush its buffers by calling flush(): http://php.net/flush. Be aware though that some browsers, also wait until they have had enough data to actually show anything.