PHP pack and unpack touch board characters character meanings

  • 2020-03-31 16:46:47
  • OfStack

Possible values of the format parameter:
A - NUL - padded string
A - SPACE - padded string
Hex string, low nibble first
Hex string, high nibble first
C - signed char
C - unsigned char
S-signed short (always 16 bit, machine byte order)
S-unsigned short (always 16 bit, machine byte order)
N-unsigned short (always 16 bit, big endian byte order)
V - unsigned short (always 16 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 32 bit, machine byte order)
L-unsigned long (always 32 bit, machine byte order)
N-unsigned long (always 32 bit, big endian byte order)
V - unsigned long (always 32 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 string of bytes filled with nothing
A byte string that fills Spaces
B a bit string, in each byte the order of the bits is ascending
B a bit string, in each byte the order of the bits is descending
C a signed char (8-bit integer) value
C an unsigned char (8-bit integer) value; See U for Unicode
D double precision floating point number in native format
F a single precision floating point number in native format
H is a hexadecimal string with the lower four digits first
H is a hexadecimal string, with the highest four digits first
A signed integer value in native format
An unsigned integer value in native format
L a signed long form, always 32 bits
L an unsigned long form, always 32 bits
N a 16-bit short orthopedic, "network" byte order (big head in front)
N a 32-bit short orthopedic, "network" byte order (big head in front)
A pointer to a null-terminated string
A pointer to a fixed-length string
Q a signed quadruple (64-bit integer) value
Q an unsigned quadruple (64-bit integer) value
S is a signed short integer value, always 16 bits
S an unsigned short integer value, always 16 bits, in order of bytes related to the machine chip
A non - encoded string
U is a Unicode character number
V is a 16-bit short integer with a "VAX" byte order (small head in front)
V is a 32-bit short integer with a "VAX" byte order (small head in front)
W is an integer compressed by BER
X one null byte (ignore one byte forward)
X backs up one byte
A null-terminated (and null-filled) byte string
Rules:
1. Each letter can be followed by a number for count, if count is a * for everything else.
2. If you provide fewer parameters than $format requires, pack assumes that all missing values are null. If you provide more parameters than $format requires, the extra parameters are ignored.

Related articles: