Last active
December 12, 2015 00:58
-
-
Save jheth/4687672 to your computer and use it in GitHub Desktop.
PHP ANSI Color Control
This file contains hidden or 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 | |
| echo chr(27) . '[32m' . "This is a green line" . chr(27) . '[0m' . "\n"; | |
| echo chr(27) . '[31m' . "This is a red line" . chr(27) . '[0m' . "\n"; | |
| function move_right($x) { echo chr(27) . "[{$x}C"; sleep(1); } | |
| function move_left($x) { echo chr(27) . "[{$x}D"; sleep(1); } | |
| function move_up($x) { echo chr(27) . "[{$x}A"; sleep(1); } | |
| function move_down($x) { echo chr(27) . "[{$x}B"; sleep(1); } | |
| move_right(1); | |
| move_right(1); | |
| move_right(1); | |
| move_right(1); | |
| move_right(1); | |
| move_up(1); | |
| move_up(1); | |
| move_up(1); | |
| move_left(1); | |
| move_left(1); | |
| move_left(1); | |
| move_left(1); | |
| move_left(1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment