Name
pack
Synopsis
string pack(stringformat
, mixedarg1
[, mixedarg2
[, ... mixedargN
]])
Creates a binary string containing packed versions of the given
arguments according to format. Each character may be followed by a
number of arguments to use in that format, or an asterisk
(*
), which uses all arguments to the end of the
input data. If no repeater argument is specified, a single argument
is used for the format character. The following characters are
meaningful in the format
string:
|
NUL-byte-padded string |
|
Space-padded string |
|
Hexadecimal string, with the low nibble first |
|
Hexadecimal string, with the high nibble first |
|
Signed char |
|
Unsigned char |
|
16-bit, machine-dependent byte-ordered signed short |
|
16-bit, machine-dependent byte-ordered unsigned short |
|
16-bit, big-endian byte-ordered unsigned short |
|
16-bit, little-endian byte-ordered unsigned short |
|
Machine-dependent size and byte-ordered signed integer |
|
Machine-dependent size and byte-ordered unsigned integer |
|
32-bit, machine-dependent byte-ordered signed long |
|
32-bit, machine-dependent byte-ordered unsigned long |
|
32-bit, big-endian byte-ordered unsigned long |
|
32-bit, little-endian byte-ordered unsigned long |
|
Float in machine-dependent size and representation |
|
Double in machine-dependent size and representation |
|
NUL-byte |
|
Back up one byte |
|
Fill to absolute position (given by the repeater argument) with NUL-bytes |
Get Programming PHP now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.