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 846861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:41:10+00:00 2026-05-15T06:41:10+00:00

I have the following: echo time().<br>; sleep(1); echo time().<br>; sleep(1); echo time().<br>; I wrote

  • 0

I have the following:

echo time()."<br>";

sleep(1);
echo time()."<br>";

sleep(1);
echo time()."<br>";

I wrote the preceding code with intention to echo time()."<br>" ln 1,echo time()."<br>" ln 4, wait a final second and then echo the final time()."<br>". Altough the time bieng echoed is correct when it comes to the intervals between time(), all echo functions are echoeing after the total of the waiting period/parameters in each sleep function.

This is how the script runs:

  • Excutes.
  • Waits 2 secons.
  • echoes
    1275540664
    1275540665
    1275540666

Notice the correct incrementation in time() being echoed. My question is why is it not behaving like expected to where it echoes, waits a second, echoes again, waits one final second and then echos the last parameter?

I know my question is a little confusing due to my wording, but i will try my hardest to answer any comments regarding this, thanks.

  • 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-15T06:41:11+00:00Added an answer on May 15, 2026 at 6:41 am

    You have output buffering turned on.

    It is more efficient for PHP to buffer up output and write it all to the browser in one go than it is to write the output in small bursts. So PHP will buffer the output and send it all in one go at the end (or once the buffer gets to a certain size).

    You can manually flush the buffer by calling flush() after each call to echo (though I wouldn’t recommend this is a “real” app – but then again, I wouldn’t recommend calling sleep in a regular app, either!).

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

Sidebar

Related Questions

I have the following code: echo ' <td> <input type=button name=delete value=X onclick=clearSelection(this.form, '.$type.');this.form.submit();
So I have the following code: echo '<li><a href="'.$Website.$Elements[2].'/'.$Row["povezava"].'" class="leftMenuArticlesInactive"></a><li>'; $Website contains: http://www.somesite.com/test/ $Elements[2]
I have the following PHP code: <?php if(isset($_GET['article'])) { echo <b>success</b>; } ?> And
I have the following js files in my code for EditInPlace... <?php echo $javascript->link('jquery.js');?>
i have the following code : <input type=text value=<?php echo $_GET['msg']; ?>> This input
I have the following piece of code. <?php $agentId = LTH001; echo && .
I have the following code $time = strtotime(date('Y-m-d 00:00', strtotime(gmdate('Y-m-d H:i')) + 0)); Its
I have the following code $getchats = $api->call(getLatestChats); echo '<pre>'; print_r(array_values($getchats)); echo '</pre>'; which
I have the following code: $radate = date('Y-d-m h:i:s'); echo $radate; foreach($_POST['member'] as $member)
I have the following code for an echo client that sends data to an

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.