Last active
September 7, 2018 20:52
-
-
Save Itachi261092/2f735d3d7960caa339a94a787c37936a to your computer and use it in GitHub Desktop.
This is simpliest progress-bar for php scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prgrsbr($oneStep, $maxSteps){ | |
$percent = $oneStep / $maxSteps * 100; | |
$width = $percent * 10; // CSS property. 1% = 10px / 100% = 1000px | |
echo '<div style="width:1000px;height:40px;border:1px solid black;"><div style="width:'.$width.'px;height:40px;line-height:40px;background-color:green;text-align:center">'.$percent.'%</div></div>'; | |
} | |
$iMax = 10000; | |
for ($i = 1; $i <= $iMax; $i++) { | |
prgrsbr($i, $iMax); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment