Progress Bar for your PHP loop
I discovered this great piece of code at php.net� and modified it into a function you can use for any loop.
<code>
function progressBar($num, $i, $l) {
global $d;
echo “</table>
</table>
</table>”;
$currentpercent = $i/$num * 100;
$currentpercent = sprintf(”%01.2f”,$currentpercent);
$p = $num * .05;
$l++;
//This div will show loading percents
echo ‘
<div class=”percents”>’ . $currentpercent . ‘% complete</div>
‘;
//This div will show progress bar
if ($l > $p) {
$l = ‘0′;
$d = $d + 11;
$left = $d + 290;
echo ‘
<div class=”blocks” style=”left: ‘. $left .’px”> </div>
‘;
}
flush();
ob_flush();
return $l;
}
</code>