mkr@binarywerks.dk note change...
| From: | Martin Krøis | Date: | Thu, 11 Sep 2003 12:20:36 +0000 |
| Subject: | mkr@binarywerks.dk note change... | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969356279@lists.php.net to get a copy of this message | ||
Hello.
I 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 so I can resubmit :\
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!!! It's the best!