mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-07 02:09:59 +00:00
import MessagePack for PHP
This commit is contained in:
parent
254ee80c16
commit
99a2d28592
16 changed files with 2321 additions and 0 deletions
19
php/test_normal.php
Executable file
19
php/test_normal.php
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
//$data = array(array(null=>1), array("takei"=>"hide"), 3);
|
||||
//$data = array("more"=>10, "test", null);
|
||||
//$data = array();
|
||||
$data = array(0=>1,1=>2,2=>3);
|
||||
var_dump($data);
|
||||
|
||||
// serialize
|
||||
$msg = msgpack_pack($data);
|
||||
|
||||
// hexadecimal
|
||||
$str = unpack('H*', $msg);
|
||||
var_dump("0x".$str[1]);
|
||||
|
||||
// deserialize
|
||||
$ret = msgpack_unpack($msg);
|
||||
var_dump($ret);
|
||||
?>
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue