note 79170 deleted from language.operators.arithmetic by hholzgra

From: Date: Thu, 02 Aug 2012 15:06:56 +0000
Subject: note 79170 deleted from language.operators.arithmetic by hholzgra
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-189818@lists.php.net to get a copy of this message
Note Submitter: daevid at daevid dot com ---- Here's a neat little trick to use ASCII escape codes to show processing in a CLI script. #!/usr/bin/php -q <?php //http://www.cs.csubak.edu/Tables_Charts/VT100_Escape_Codes.html define('ESC', 27); printf( "%c[2J", ESC ); //clear screen //note how the '-' is at [1], not [0] $cursorArray = array('/','-','\\','|','/','-','\\','|'); echo "Processing: "; printf( "%c7", ESC ); //save cursor position for ($count = 1; $count <= 30; $count++) { //note that $i is all self contained. printf("%c8(".$cursorArray[ (($i++ > 7) ? ($i = 1) : ($i % 8)) ].") %02d", ESC, $count); //restore cursor position and print sleep(1); } echo "\nDone.\n"; ?>

« previous php.notes (#189818) next »