Created
October 30, 2017 13:19
-
-
Save cergey-obr/a5845d11fdc0d85025ef268ee2cca454 to your computer and use it in GitHub Desktop.
Snippet to emulate a little loading char in terminal
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
<?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