Новости | Документация | Download | Webboard | FAQ | Поиск | Контакты


unpack

(PHP 4, PHP 5)

unpackUnpack data from binary string

Описание

array unpack ( string $format , string $data )

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

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 /.

Список параметров

format

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

data

The packed data.

Возвращаемые значения

Returns an associative array containing unpacked elements of binary string.

Примеры

Пример #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.

Смотрите также

  • pack() - Pack data into binary string






  Copyright Apache.ru © 1999-2017, All Rights Reserved Разработка сайта: Inside.ru  
  РЕКЛАМА НА САЙТЕ: |