Improved progress bar which is utilizing immediate JavaScript commands to change the progress bar’s DIV width (controlled from PHP). No sessions and no AJAX required.
http://spidgorny.blogspot.com/2012/02/progress-bar-for-lengthy-php-process.html
<?php
require_once ‘nadlib/class.ProgressBar.php’;
$p = new ProgressBar();
$p->render();
for ($i = 0; $i < ($size = 100); $i++) {
$p->setProgressBarProgress($i*100/$size);
usleep(1000000*0.1);
}