From:             [EMAIL PROTECTED]
Operating system: solaris 7
PHP version:      4.0.4pl1
PHP Bug Type:     Strings related
Bug description:  unpack 'h' and 'H' formats don't work

In the following sample the variable "encoded" is zero length; an empty string.  If I 
change the format chars from H and h to C then it does get stuff.

<script language="php">

// 0xFF * 0xEE
$ch = 60690;

$encoded = "";

$hexn = unpack("Hz", $ch); // high nibble
if (isset($hexn["z"]))
  $encoded .= $hexn["z"];
else
  $encoded .= "-";

$hexn = unpack("hz", $ch); // low nibble
if (isset($hexn["z"]))
  $encoded .= $hexn["z"];
else
  $encoded .= "-";

echo $encoded . "<br>";
echo strlen($encoded) . "<br>";

</script>



-- 
Edit Bug report at: http://bugs.php.net/?id=9168&edit=1



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to