\Horde_Pack

A replacement for serialize()/json_encode() that will automatically use the most efficient serialization available based on the input.

Summary

Methods
Properties
Constants
__construct()
__sleep()
pack()
unpack()
No public properties found
DEFAULT_COMPRESS
COMPRESS_MASK
No protected methods found
$_compress
$_drivers
N/A
No private methods found
No private properties found
N/A

Constants

DEFAULT_COMPRESS

DEFAULT_COMPRESS

COMPRESS_MASK

COMPRESS_MASK

Properties

$_compress

$_compress : \Horde_Compress_Fast

Instance of Horde_Compress_Fast shared between all instances.

Type

\Horde_Compress_Fast

$_drivers

$_drivers : array

Drivers. Shared between all instances.

Type

array

Methods

__construct()

__construct() 

Constructor.

__sleep()

__sleep() 

pack()

pack(mixed  $data, array  $opts = array()) : string

Pack a string.

Parameters

mixed $data

The data to pack.

array $opts

Additional options:

  - compress: (mixed) If false, don't use compression. If true, uses
              default compress length (DEFAULT). If 0, always compress.
              All other integer values: compress only if data is
              greater than this string length.
  - drivers: (array) Only use these drivers to pack. By default, driver
             to use is auto-determined.
  - phpob: (boolean) If true, the data contains PHP serializable
           objects (i.e. objects that have a PHP-specific serialized
           representation). If false, the data does not contain any of
           these objects. If not present, will auto-determine
           existence of these objects.

Throws

\Horde_Pack_Exception

Returns

string —

The packed string.

unpack()

unpack(string  $data) : mixed

Unpack a string.

Parameters

string $data

The packed string.

Throws

\Horde_Pack_Exception

Returns

mixed —

The unpacked data.