We have 36 guests online
PHP Scripts arrow Free PHP Tutorials arrow Free PHP Tutorials arrow PHP Tutorials and Examples arrow PHP 
Free PHP Tutorials arrow PHP Tutorials and Examples arrow PHP

Using ob_flush to push output to browser
User Rating: / 4
PoorBest 
This script cycles through an array and prints something to the browser for every loop. It sleeps 2 seconds for each loop after pushing the content to the browser. Very useful in some instances, but may not work for all browsers.

 

  1. <?php
  2.  
  3. if (ob_get_level() == 0) ob_start();
  4.  
  5. for ($i = 0; $i<10; $i++){
  6.        echo "<br> Line to show.";
  7.        echo str_pad('',4096)."n";   
  8.  
  9.        ob_flush();
  10.        flush();
  11.        sleep(2);
  12. }
  13.  
  14. echo "Done.";
  15.  
  16.  
  17. ?>

 

 

Directory Stats

There are 1036 listing and 46 categories in our website

Change Language