MessagePack::pack PHP Method

pack() public method

public pack ( mixed $value ) : string
$value mixed
return string
    public function pack($value)
    {
    }

Usage Example

示例#1
0
function test($type, $variable, $test = null)
{
    $msgpack = new MessagePack();
    $serialized = $msgpack->pack($variable);
    $unserialized = $msgpack->unpack($serialized);
    var_dump($unserialized);
    if (!is_bool($test)) {
        echo $unserialized === $variable ? 'OK' : 'ERROR', PHP_EOL;
    } else {
        echo $test || $unserialized == $variable ? 'OK' : 'ERROR', PHP_EOL;
    }
}
All Usage Examples Of MessagePack::pack