note 110102 added to function.unpack
| From: | googlybash24 at aol dot com | Date: | Wed, 19 Sep 2012 17:20:33 +0000 |
| Subject: | note 110102 added to function.unpack | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-190882@lists.php.net to get a copy of this message | ||
To convert big endian to little endian or to convert little endian to big endian, use the following
approach as an example:
<?php
// file_get_contents() returns a binary value, unpack("V*", _ ) returns an unsigned long
32-bit little endian decimal value, but bin2hex() after that would just give the hex data in the
file if alone, so instead we use:
// file_get_contents(), unpack("V*", _ ), then dechex(), in that order, to get the
byte-swapping effect.
?>
With the logic of the approach in this example, you can discover how to swap the endian byte order
as you need.
----
Server IP: 69.147.83.197
Probable Submitter: 71.172.140.197
----
Manual Page -- http://www.php.net/manual/en/function.unpack.php
Edit -- https://master.php.net/note/edit/110102
Del: integrated -- https://master.php.net/note/delete/110102/integrated
Del: useless -- https://master.php.net/note/delete/110102/useless
Del: bad code -- https://master.php.net/note/delete/110102/bad+code
Del: spam -- https://master.php.net/note/delete/110102/spam
Del: non-english -- https://master.php.net/note/delete/110102/non-english
Del: in docs -- https://master.php.net/note/delete/110102/in+docs
Del: other reasons-- https://master.php.net/note/delete/110102
Reject -- https://master.php.net/note/reject/110102
Search -- https://master.php.net/manage/user-notes.php