Skip to content

Instantly share code, notes, and snippets.

@ivanrosolen
Created June 10, 2019 17:55
Show Gist options
  • Save ivanrosolen/31652ee2adc548860747b93e2c472b37 to your computer and use it in GitHub Desktop.
Save ivanrosolen/31652ee2adc548860747b93e2c472b37 to your computer and use it in GitHub Desktop.
Cli Progress Bar Loop
#!/usr/bin/php
<?php
$iloop = "0";
while (true){
$warn = "Program running hold on!!\r";
if (strlen($warn) === $iloop+1){
$iloop = "0";
}
$warn = str_split($warn);
$iloop++;
$warn[$iloop] = "\033[35;2m\e[0m".$warn[$iloop];
echo " \033[7m".implode($warn);
usleep(90000);
}
// for i in {30..49};do echo -e "\033[$i;7mReversed color code $i\e[0m Hello world";done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment