Format characters for pack( ) and unpack( ) : pack « Utility Function « PHP






Format characters for pack( ) and unpack( )

 
Format character    Data type
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
S                   unsigned short
n                   unsigned short
v                   unsigned short
i                   signed int (machine-dependent size and byte order)
I                   unsigned int (machine-dependent size and byte order)
l                   signed long (32 bit, machine byte order)
L                   unsigned long (32 bit, machine byte order)
N                   unsigned long (32 bit, big endian byte order)
V                   unsigned long (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
  
  








Related examples in the same category

1.Generating fixed-width field data records