problems / mistake in pack () and unpack() ???
| From: | Burkhard Herre | Date: | Wed, 18 May 2005 15:35:31 +0000 |
| Subject: | problems / mistake in pack () and unpack() ??? | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-26023@lists.php.net to get a copy of this message | ||
hello
i use the function pack() and unpack()
i have following question:
$content = -2147483647;
$binarydata = pack("V", $content);
...(fwrite in file)
...(fread from file)
$bin_str = fread ($handle, 4);
$ascii_array = unpack("V", $bin_str);
$ascii_str = $ascii_array[1];
it makes no difference if i use the "V", the "l" or the "L" flag !
every flag works the same...output is '-2147483647'
but from the php page i get this:
l -- Long-Typ with sign (always 32 Bit, Byte-sequenz maschine depent)
L -- Long-Typ without sign (always 32 Bit, Byte-sequenz maschine depent)
V -- Long-Typ without sign (always 32 Bit, little endian)
why is it so ?
what happends ?
thank you