GnuDeveloper.com

Packing and Unpacking for 64 bit Data in PHP 5.3

In arise of PHP 5.3 supports of 64 bit data processing , But small things was missed like
Packing and Unpacking for 64 bit. in Perl , Q argument used for processing 64 bit data.

<?php
$vBinData 
pack("Q"0x123456781234568);
$vHexData bin2hex($vBinData);
var_dump($vHexData);
list(,
$v32Value) = unpack('Q'chr(0x80).chr(0x00).chr(0x00).chr(0x00).chr(0x00).chr(0x00).chr(0x00).chr(0x09));
print 
$v32Value;
echo 
hexdec(dechex($v32Value)) . "0x" dechex($v32Value)  ;
?>

All the Extension source code is located at php5.3-200904221230/ext/. Hence Adding functionlaity for packing & unpacking for 64 bit, download teh source code
from here http://www.gnudeveloper.com/software/php-5.3/pack.c and paste it to location at
php5.3-200904221230/ext/standard/

and then compile it , run enjoy it

Groups: