Is it possible to have print_r() displayed live. By live I mean while the script is executed. I do not want to wait the end of the script to have it displayed. Hope I am clear. Thank you in advance for your replies. Cheers. Marc
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Likely you are using PHP through a webserver like Apache.
Webservers have caching implemented, they tend to send their data out in larger blocks.
Browsers also have caching implemented, they only refresh the data from time to time and at the end when they finished loading the website.
Finally PHP also has caching built in.
HTTP was not made for “live” display it’s more like a static page, that’s why people invented “AJAX” and Javascript to poll for changed/live events after a page was loaded.
What you can do:
flush()There is also a php setting called
implicit_flushyou might want to look up.Maybe that will do it:
@apache_setenv('no-gzip', 1);</table>it’s more likely browsers will display it during load.output_buffering = Offzlib.output_compression = OffYou can do this at runtime too (
@ini_set('zlib.output_compression', 0);)If I recall right 256 byte might help.
str_repeat(" ", 256);(or anything else)I’d like to add that these steps can help solve the issue but from my experience the results are not perfect.
Every new browser and browser version might act different.