Skip to content

Instantly share code, notes, and snippets.

@aerith
Created August 15, 2012 12:17
Show Gist options
  • Save aerith/3359652 to your computer and use it in GitHub Desktop.
Save aerith/3359652 to your computer and use it in GitHub Desktop.
<?php
function bar ($n) {
return implode('', array_pad(array(), $n, '#')) . implode('', array_pad(array(), 100 - $n, '-'));
}
array_map(function ($i) {
printf('%3d%% [|%s|]', $i, bar($i));
usleep(2000000);
print "\r";
}, range(1, 100));
print "\n";
// From:
// => 1% [|#---------------------------------------------------------------------------------------------------|]
// To:
// => 100% [|####################################################################################################|]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment