LOADING STUFF...

PHP:unpack()的用法_misc函数

技术教程5小时前更新 北陌
8 0 0

PHP:unpack()的用法_misc函数

unpack

(PHP 4, PHP 5)

unpack — Unpack data from binary string

说明

array unpack
( string $format
, string $data
)

Unpacks from a binary string into an array according to the given
format.

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 /. If a repeater argument is present,
then each of the array keys will have a sequence number behind
the given name.

参数

format

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

data

The packed data.

返回值

Returns an associative array containing unpacked elements of binary
string.

更新日志

版本
说明
5.5.0

Changes were made to bring this function into line with Perl:

The “a” code now retains trailing NULL bytes.

The “A” code now strips all trailing ASCII whitespace (spaces, tabs,
newlines, carriage returns, and NULL bytes).

The “Z” code was added for NULL-padded strings, and removes trailing
NULL bytes.

范例

Example #1 unpack() example

$binarydata

© 版权声明

相关文章

暂无评论

暂无评论...