Wrong code in post.
| From: | Martin Krøis | Date: | Thu, 11 Sep 2003 12:25:21 +0000 |
| Subject: | Wrong code in post. | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969356278@lists.php.net to get a copy of this message | ||
Hello, hope this is the right adress:
I (mkr@binarywerks.dk) 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.