Skip to content

Instantly share code, notes, and snippets.

@rudiedirkx
Created August 3, 2013 13:02
Show Gist options
  • Save rudiedirkx/6146373 to your computer and use it in GitHub Desktop.
Save rudiedirkx/6146373 to your computer and use it in GitHub Desktop.
<?php
writeln();
writeln('starting...');
write('Progress: [ 0 % ]');
for ( $i=1; $i<=100; $i++ ) {
usleep(rand(100, 100000));
backspace(7);
$white = str_repeat(' ', 3 - strlen($i));
write($white . $i . ' % ]');
}
writeln();
writeln('Whatever... Done!');
writeln();
exit(0);
function backspace( $num = 1 ) {
while ( $num-- ) echo chr(8);
}
function write( $txt ) {
echo $txt;
}
function writeln( $txt = '' ) {
echo $txt . "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment