Skip to content

Instantly share code, notes, and snippets.

@cergey-obr
Created October 30, 2017 13:19
Show Gist options
  • Save cergey-obr/a5845d11fdc0d85025ef268ee2cca454 to your computer and use it in GitHub Desktop.
Save cergey-obr/a5845d11fdc0d85025ef268ee2cca454 to your computer and use it in GitHub Desktop.
Snippet to emulate a little loading char in terminal
<?php
$chars = ["|","/","-","\\"];
$milisecondsToWait = 100;
for($i = 0;$i < count($chars);$i++)
{
echo "\r";
echo $chars[$i];
usleep($milisecondsToWait * 1000);
if($i == (count($chars) -1)){
$i = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment