Hello, hope this is the right adress:

I ([EMAIL PROTECTED]) just recently added a note the page:
http://dk2.php.net/bin2hex, but
discovered that the way I wrote the code is useless or at least quite akward
(it's not gone online yet as I write this)

I'd like to change it if possible.

I am sorry about the error, and I hope you can change it or at least delete
my note (and notify me) so I can resubmit it :\

Here's the better code:

#!/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");
}
?>

Thank you for your great work on PHP!!!

Kind regards,

Martin K.

Reply via email to