title: PHP is not updating the current time inside while loop
body: <p>Am trying to get current time and show it in the console using PHP CLI script. The problem is, am unable to get current time updated inside a while loop that runs infinitely but sleeps every second. Whatever the time I get when the program starts, will stick till the program ends.</p>
  
  <pre><code>&lt;?php
  
  date_default_timezone_set("Asia/Kolkata");
  
  while(1) {
      $ts = new DateTime();
      $ts-&gt;getTimestamp();
      $now_ts = $ts-&gt;format("H:m:i");
      echo "\n{$now_ts}";
  
      sleep(1);
  }
  </code></pre>
  
  <p>Am not able to understand what is happening here. Please help.</p>