PHP does not attribute other categories of functions called Miscellaneous functions, also attributes PHP's core components
Pack ($format, arg+)//load data into a binary string
$format: Required to specify the format to use when wrapping data.
arg+: Optional, specify one or more parameters to be packaged
Possible values for $format parameters
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
As an example:
Echo Pack ("S", +); // If there is no data behind the format s or a specific number or *, then there can be only one argument later, if there is a specific number later, then the following argument is so many
P
Echo Pack ("C3", 80,72,80); Indicates that there can be only 3 parameters at a later //PHP
$str NULL ; for ($i= 0; $i<20; $i++) {$strpack("S",mt_rand(80,128)); } Echo $str ; // M{qxim^wslts_w[kvrsu
Echo Pack ("c*", 80,72,80); // indicates that only 3 parameters can be followed//php
The pack of PHP's function