Converting a binary integer to a number
| From: | Siegfried Kettlitz | Date: | Mon, 07 May 2001 18:36:23 +0000 |
| Subject: | Converting a binary integer to a number | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-51803@lists.php.net to get a copy of this message | ||
I have binary data (ie: 0x7b c8 15 0c ) and want to convert it into a 32Bit
integer (here: 123456789012).
Currently I use this (intel-little-endian):
$integer = hexdec( bin2hex( strrev( readpos( $fd,$position,4 ) ) ) );
readpos reads 4 bytes from a file
Is there a better, faster or easier way to do the same thing?