pack in php means "loading". The pack() function is a miscellaneous function in php. This function is used to load data into a binary string. The syntax is "pack(format,args )", "format" indicates the format used when packaging data, and "args" indicates the packed parameters.
The operating environment of this tutorial: Windows 10 system, PHP version 7.1, DELL G3 computer.
What does pack in php mean?
pack in php means loading.
pack() function loads data into a binary string.
The syntax is as follows:
pack(format,args+)
The parameter format indicates the format used when packaging data.
a - NUL padded string
A - SPACE padded string
h - Hexadecimal string, low byte first
H - Hexadecimal string, high byte first
c - signed char
C - unsigned char
s - signed short (always 16 bits, machine byte order)
S - unsigned short (always 16 bits, machine byte order)
n - unsigned short (always 16 bits, big endian byte order)
v - unsigned short (always 16 bits, little endian byte order)
i - signed integer (depends on machine size and byte order)
I - unsigned integer (depends on machine size and byte order)
l - signed long (total Is 32 bits, machine byte order)
L - unsigned long (always 32 bits, machine byte order)
N - unsigned long (always 32 bits, big endian byte order)
V - unsigned long (always 32 bits, little endian byte order)
f - float (depends on machine size and representation)
d - double (depends on machine size and representation)
x - NUL byte
X - Back up one byte
Z - NUL padded string
@ - NUL fills the absolute position
Parameter args represents one or more parameters that are specified to be packed.
Examples are as follows:
<?php echo pack("C3",80,72,80); ?>
If you are interested, you can click on "PHP Video Tutorial" to learn more about PHP knowledge.
The above is the detailed content of What does pack in php mean?. For more information, please follow other related articles on the PHP Chinese website!