WMMEGA FW >= 2.1167
unpack — Unpack data from binary string
Unpacks from a binary string into an array according to the given format.
$format: String containing one of the following values:
Value | Description |
---|---|
l | signed long (always 32 bit, machine byte order) |
L | unsigned long (always 32 bit, machine byte order) |
f | floating point(always 32 bit, machine byte order) |
c | signed byte |
C | unsigned byte |
$value: Value is a binary string passed by reference (&).
mixed: Unpacked value from binary string
<? v=-1234; $str=pack("l",$v); print("\r\nPacked signed long:\r\n"); for ($i=0;$i<4;$i++) { $c=charat($str,$i); printf("%02X ",$c); } print("\r\nUn packed signed long:\r\n"); $v=unpack("l",&$str); // <--- Note the & symbol - this needs to be passed by reference. print($v); ?>
pack() - Pack a binary string