note 35696 deleted from function.bin2hex by didou

From: Date: Tue, 02 Dec 2003 16:04:12 +0000
Subject: note 35696 deleted from function.bin2hex by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-61274@lists.php.net to get a copy of this message
Note Submitter: mkr@binarywerks.dk ---- A silly hack (which could prove to have some usefulness) to create a "progress indikator" using Andreas Schmeiler's hex2bin: Run this in command line: #!/usr/bin/php4 -q <? $progress1="."; $progress2=":"; $progress=$progress1; function hex2bin($hexdata) {         for ($i=0;$i<strlen($hexdata);$i+=2)         {                 $bindata.=chr(hexdec(substr($hexdata,$i,2)));         }         return $bindata; } for($i=0;$i<50000; $i++) {         sleep(1);         echo ($progress==$progress1) ? $progress=$progress2 : $progress=$progress1;         echo hex2bin("08"); } ?> NB: The sleep function is only for demonstration purpose :) Also the 08 migth be OS dependent, this code has been tested on linux only.

« previous php.notes (#61274) next »