title: While echo - dont write mutiple lines, overwrite one instead
body: <p>im trying to write a loop that displays the counter on one line, been sitting here for over an hour but cant figure it out.</p>
  
  <p>The main loop is</p>
  
  <pre><code>while($counter&lt; 100){               
      echo $counter;
      usleep($timeInSeconds*1000000);
      $counter=$counter+1;
  }
  </code></pre>
  
  <p>Now this prints 100 numbers after a delay each on a new line. Is it possible for the echo to instead replace itself for each loop?</p>
  
  <hr>
  
  <p>I tried many options, here is one that didnt crash:</p>
  
  <pre><code>while($counter &lt; 100){
  
          $counter=$counter+1;
          echo $counter;
          usleep($timeInSeconds*1000000);
  
          flush();
          ob_flush();    
      }
  </code></pre>
  
  <p>However, with this option it works in one line with a delay, but it doesnt clear the previous echo, so its just a bunch of number next to each other</p>
  
  <p>Could someone help me out?</p>