Re: Re: Binary mah
| From: | Knightking | Date: | Fri, 11 Jun 2004 06:12:38 +0000 |
| Subject: | Re: Re: Binary mah | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-188089@lists.php.net to get a copy of this message | ||
On Thu, 10 Jun 2004 20:08:08 -0700, Justin Patrin <papercrane@reversefold.com> wrote:
Mark wrote:$a = $packed & 0x1; $b = $packed & 0x2; $c = $packed & 0x4; $d = $packed & 0x8; $e = $packed & 0x10; $f = $packed & 0x20; $g = $packed & 0x40; $h = $packed & 0x80; $i = $packed & 0x100; Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/[snip]I'm not sure what's wrong with the code you have, but for the 4-digit one you have: $packed = 4-bit var with ABCD encoded in it $a = $packed & 1; $b = $packed & 2; $c = $packed & 4; $d = $packed & 8; Just as a side tip, I highly recommend using hexadecimal for bitwise functions where possible, i.e.: