NYCPHP Meetup

NYPHP.org

[nycphp-talk] CLI output question

Joel De Gan joel at tagword.com
Wed Aug 17 19:27:47 EDT 2005


Oh yea..
should have said that is only going to work on linux, all my development
is done on linux so I usually don't even think about if something will
work on windows..

-joel

On Wed, 2005-08-17 at 16:53 -0400, Dan Cech wrote:
> Joel,
> 
> I played a little with your spinner and couldn't get it to work 
> properly.  I did come up with this though, which works on both my WinXP 
> laptop and Linux dev server:
> 
> function progress()
> {
>    static $spinnerpos = 0;
>    static $spinner = '-';
>    $spinners = array('-','\\','|','/');
> 
>    echo $spinner;
>    flush();
> 
>    $spinnerpos = ($spinnerpos+1)%4;
>    $spinner = "\x8".$spinners[$spinnerpos];
> }
> 
> Dan
> 
> Joel De Gan wrote:
> > here is one I made the other day for doing a spin-cursor on FTP
> > transfers:
> > 
> > // just call with no arguments inside a loop.
> > function progress(){
> > 	global $spinnerpos;
> > 	$spinner = array("/","-","\\","\\|","/","-","\\","\\|");
> > 	passthru("printf \"\\b\"".$spinner[$spinnerpos] ." ");
> > 	$spinnerpos=($spinnerpos +1)%8;
> > }
> > 
> > Cheers.
> > -joel
> _______________________________________________
> New York PHP Talk Mailing List
> AMP Technology
> Supporting Apache, MySQL and PHP
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org
> 
> 
> 




More information about the talk mailing list