Possible values for the format parameter:
a-nul-padded string
a-space-padded string
H-hex string, low nibble first
H-hex string, high nibble first
c-signed Char
c-unsigned Char
s-signed short (always the bit, machine byte order)
s-unsigned short (always the bit, machine byte order)
n-unsigned short (always the bit, big endian byte order)
v-unsigned short (always-on bit, little endian byte order)
i-signed integer (Machine dependent size and byte order)
i-unsigned integer (Machine dependent size and byte order)
L-signed long (always the bit, machine byte order)
L-unsigned long (always the bit, machine byte order)
N-unsigned long (always the bit, big endian byte order)
V-unsigned long (always the bit, little endian byte order)
F-float (Machine dependent size and representation)
D-double (Machine dependent size and representation)
X-nul byte
X-back up one byte
@-Nul-fill to absolute position
A a filled empty byte string
A a byte string that fills a space
b A bit string, in which the order of bits in each byte is ascending
b A bit string, in which the order of bits in each byte is descending
c A signed char (8-bit integer) value
c an unsigned char (8-bit integer) value; about Unicode see u
D double-precision floating-point number in native format
F single-precision floating-point number in native format
h a hexadecimal string, low four bits in front
h a hexadecimal string, high four bits in front
I a signed integer value, native format
I an unsigned integer value, native format
L A signed long shaping, always 32 bits
L An unsigned long shaping, always 32 bits
N A 16-bit short shaping, "Network" byte order (head in front)
N A 32-bit short shaping, "Network" byte order (head in front)
p A pointer to a string with a null end
p A pointer to a fixed-length string
Q A signed four times-fold (64-bit integer) value
Q An unsigned four times-fold (64-bit integer) value
s a signed short integer value, always 16 bits
s an unsigned short integer value, always 16 bits, byte sequence related to the machine chip
U a non-encoded string
U a Unicode character number
V A "VAX" byte sequence (small head in front) of a 16-bit short integer
V A "VAX" byte sequence (small head in front) of a 32-bit short integer
W A ber-compressed integer
X an empty byte (ignoring one byte forward)
x Backup of one byte
Z a null-terminated (and empty-filled) byte string
Rules:
1. Each letter can be followed by a number, indicating count (count), if Count is a * represents the rest of everything.
2. If you provide fewer parameters than the $format requires, the pack assumes that the missing is a null value. If you provide more parameters than $format, then the extra parameters are ignored.
http://www.bkjia.com/PHPjc/320732.html www.bkjia.com true http://www.bkjia.com/PHPjc/320732.html techarticle possible values for the format parameter: a-nul-padded string a-space-padded string H-hex string, low nibble first H-hex string, high nib BLE first c-signed char c-unsigned char s-s ...