pack
mixed pack(string format, mixed args, [mixed args])
format | Format to use to pack the data |
args | Piece of data to be packed into the string |
args | Zero or more additional arguments to be packed into the string |
Creates a binary string from a list of values.
Returns:
Binary string; FALSE on error
Description:
pack() transforms a list of values into a sequence of bits based on a user-defined format. It’s a powerful tool that allows developers to work directly with binary data. pack() can be used for many purposes—from simple tasks such as trimming and padding strings to more complex tasks such as altering binary files.
Calls to the function look like this:
$binary_string = pack ('C4', 128, 9, 176, 32);
The first argument contains the format ...
Get PHP Functions Essential Reference 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.