PHP 手冊
前一頁 |  | 下一頁

# unpack

(PHP 3, PHP 4 , PHP 5)

unpack -- Unpack data from binary string

## Description

array unpack ( string format, string data )

unpack() from binary string into array according to format. Returns array containing unpacked elements of binary string.

unpack() works slightly different from Perl as the unpacked data is stored in an associative array. To accomplish this you have to name the different format codes and separate them by a slash /.

範例 1. unpack() example

`<?php $array = unpack("c2chars/nint", $binarydata); ?>`

The resulting array will contain the entries "chars1", "chars2" and "int".

注意
Note that PHP internally stores integral values as signed. If you unpack a large unsigned long and it is of the same size as PHP internally stored values the result will be a negative number even though unsigned unpacking was specified.

See also pack() for an explanation of the format codes.

前一頁 | 內容 | 下一頁
uniqid | 上一層 | usleep