gaetanopeti

php for loop

Jan 11th, 2022
1,354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <head>
  3.     <meta charset="UTF-8">
  4.     <title>Loop</title>
  5.    
  6.  
  7.     <?php   //https://stackoverflow.com/questions/10144780/how-do-echo-out-progress-on-mamp-using-flush/10145076#10145076
  8.         ob_start();
  9.        
  10.         ob_implicit_flush(true);
  11.        
  12.         set_time_limit(0);
  13.  
  14.  
  15.     $buffer = str_repeat(".", 16384);
  16.     echo $buffer."\r\n<br />\r\n";
  17.  
  18.     for ($i=0; $i<20; $i++) {
  19.         echo ($i+1).""."\r\n<br />\r\n".$buffer."\r\n<br />\r\n";
  20.         ob_flush();
  21.         flush();
  22.         //sleep(1);
  23.         usleep(500000);
  24.     }
  25.  
  26.  
  27.         ob_end_flush();
  28.     ?>
  29.  
  30.  
  31. </body>
  32. </html>
Advertisement
Add Comment
Please, Sign In to add comment