======pack======
WMMEGA FW >= 2.1167
pack — Pack data into binary string
====Description====
string
pack (
string
$format,
mixed
$value
)
Pack given arguments into a binary string according to format.
====Parameters====
$format: String containing one of the following items:
^ 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 dependent on the function.
====Return Values====
string: Binary string containing value
====Example====
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);
print($v);
?>
====See Also====
[[unpack()]] - Unpack a binary string