note 35696 added to function.bin2hex

From: Date: Thu, 11 Sep 2003 11:24:26 +0000
Subject: note 35696 added to function.bin2hex
Groups: php.notes 
Request: Send a blank email to php-notes+get-56067@lists.php.net to get a copy of this message
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 <? $progress[]="|"; $progress[]="/"; $progress[]="-"; $progress[]="\\"; 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++) { foreach($progress as $key) { sleep(1); echo $key.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. ---- Manual Page -- http://www.php.net/manual/en/function.bin2hex.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35696 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35696&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35696&report=yes

« previous php.notes (#56067) next »