unpack

array unpack(string format, string binary_string) 
format Format to use when unpacking
binary_string Binary string to unpack

Parses a binary string according to a user-defined format.

Returns:

Associative array; FALSE on error

Description:

unpack() is the complement of pack()—it transforms binary data into an associative array based on the format specified.

The format string consists of a format character, optionally followed by an integer. Depending on the format character, the integer either indicates a length or a quantity. The integer should be followed by a string. The string is used as the key for entries in the associative array that are created by the format code. If the format code creates more than one entry in the array, ...

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.