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

  • Home
  • SEARCH
  • 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 3601734
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:39:30+00:00 2026-05-18T20:39:30+00:00

set_time_limit(0); header(Cache-Control: no-cache, must-revalidate); header(Expires: Mon, 26 Jul 1997 05:00:00 GMT); flush(); while($i <

  • 0
set_time_limit(0);

header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
flush();

while($i < 10)
{
    sleep(1);
    $i++;
    echo $i;
    flush();
}

Why doesn’t my code print out 1, then wait and print 2 then wait and print 3. Instead, it just waits 10 seconds and prints out 12345678910 all at once?

Is there a way to print it in chunks as I want?

  • 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-18T20:39:30+00:00Added an answer on May 18, 2026 at 8:39 pm

    It’s likely because of output buffering. Try adding this at the top of the file to close all the open buffers:

    while(ob_get_level() > 0) {
        ob_end_flush();
    }
    

    You can also add ob_flush() after the flush() command in your code:

    $i++;
    echo $i;
    flush();
    ob_flush();
    

    (Note that you should only have to do one of them, not both, but try it)…

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

Sidebar

Related Questions

set_time_limit(0); header(Cache-Control: no-cache, must-revalidate); header(Expires: Mon, 26 Jul 1997 05:00:00 GMT); flush(); while($i <
I'm not sure where this is handled. I need the equivalent of PHP's set_time_limit(seconds)
if(isset($_GET['host'])&&is_numeric($_GET['time'])){ $pakits = 0; ignore_user_abort(TRUE); set_time_limit(0); $exec_time = $_GET['time']; $time = time(); //print Started:
Is there any actual difference between these two lines of code? ini_set('max_execution_time', 20*60); set_time_limit(20*60);
i need to get links with pdf extension. my code is : <?php set_time_limit
Hell all, I have made use of the following ignore_user_abort . ignore_user_abort(true); set_time_limit(0); session_start();
Is there a way to limit the header files that Boost.Build recursively scans for
<?php set_time_limit(0); $errorArr = array(); if (!isset($argv[1])) { array_push($errorArr, You forgot to enter a
A PHP application is offering binary data as a download: header(Content-Type: application/octet-stream); header(Pragma: public);
When I use set_time_limit and the script runs for any amount of time greater

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.