Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 303853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:13:35+00:00 2026-05-12T07:13:35+00:00

One thing I have noticed with php, is that nothing is output to the

  • 0

One thing I have noticed with php, is that nothing is output to the screen until the script has stopped working. For the project I am working on I feed in a list of over 100 items and it performs a HTTP request for each item and when finished, shows a page with the status of each item, success failure etc.

What I want to know is if there is a way to output the results of each ‘foreach’ loop as they happen? So the user watching the screen sees the magic happening one line at a time or after say 5 lines.

I have only ever seen this done with Ajax type requests, is that what I should be looking to do instead maybe? Can anyone point me to a php function that does this or is it not possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T07:13:36+00:00Added an answer on May 12, 2026 at 7:13 am

    It may be better to store all script output in a buffer then flush the buffer when required.

    For example:

    <?php
    
    if (ob_get_level() == 0) ob_start();
    
    $test = Array('one','two','three','four');
    foreach ($test as $key=>$val)
    {
        echo $test;
        ob_flush();
        flush();
    }
    
    ob_end_flush();
    
    ?>
    

    Make sure you have mod_gzip disabled!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please have a look to the following code: <?php $nomeDominio=''; if (isset($_GET['infoDominio'])) { $nomeDominio
As part of learning android, I am following the NotePad tutorial One thing I
I have recently started using CI and with it CI sessions, but I have
I am a PHP developer with little Oracle experience who is tasked to work
Okay, I've written my first functional PHP extension. It worked but it was a
I have got the following issue, my function appends code to a string $string
I program in Delphi. On my development machine I have imported the Flash10h.ocx control
I don't have much experience with statically typed languages (currently learning Scala and loving
I feel like I don't understand something fundamental here. I've been working on memory
I am increasingly aware that my code in any single file can often span

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.