Skip to content

Instantly share code, notes, and snippets.

@sotayamashita
Forked from drm/hide_cursor.php
Created April 29, 2016 12:09
Show Gist options
  • Save sotayamashita/64c766b14e7ca90719efbd01626d161a to your computer and use it in GitHub Desktop.
Save sotayamashita/64c766b14e7ca90719efbd01626d161a to your computer and use it in GitHub Desktop.
Hide the cursor in a PHP script with ANSI escape code
<?php
function hide_cursor($stream = STDOUT) {
fprintf($stream, "\033[?25l"); // hide cursor
register_shutdown_function(function() use($stream) {
fprintf($stream, "\033[?25h"); //show cursor
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment