note 31142 added to function.pack
| From: | bjorn at kulturkonsult dot no | Date: | Fri, 11 Apr 2003 00:20:12 +0000 |
| Subject: | note 31142 added to function.pack | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-46473@lists.php.net to get a copy of this message | ||
(Assuming Intel endian)
$hex = 0xFEEDFACE;
echo $hex."\n";
Displays 4277009102 - as expected
echo join("", unpack("N", pack("N", $hex)))."\n";
Prints -17958194; internally converted to float.
One would expect 4277009102 here as well
echo bindec(decbin(join("", unpack("N", pack("N",
$hex)))))."\n";
Workaround: wrap bindec(decbin()) around it,
then you get 4277009102 again. I would sure love to get some developers to comment on this
behaviour.
--
http://www.php.net/manual/en/function.pack.php
http://master.php.net/manage/user-notes.php?action=edit+31142
http://master.php.net/manage/user-notes.php?action=delete+31142
http://master.php.net/manage/user-notes.php?action=reject+31142