FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
msgpack/php/test_streaming.php at java-0.5.1 · WanderWalker/msgpack · GitHub
WanderWalker
msgpack
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
msgpack
/
php
/
test_streaming.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (24 loc) · 615 Bytes
Breadcrumbs
msgpack
/
php
/
test_streaming.php
Copy path
File metadata and controls
31 lines (24 loc) · 615 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
// serialized data
$
msgs
=
array
(
pack
(
"
C*
"
,
0x93
,
0x01
,
0x02
,
0x03
,
0x92
),
pack
(
"
C*
"
,
0x03
,
0x09
,
0x04
));
// streaming deserialize
$
unpacker
=
new
MessagePackUnpacker
();
$
buffer
=
""
;
$
nread
=
0
;
foreach
(
$
msgs
as
$
msg
){
$
buffer
=
$
buffer
.
$
msg
;
while
(
true
){
if
(
$
unpacker
->
execute
(
$
buffer
,
$
nread
)){
$
msg
=
$
unpacker
->
data
();
var_dump
(
$
msg
);
$
unpacker
->
reset
();
$
buffer
=
substr
(
$
buffer
,
$
nread
);
$
nread
=
0
;
if
(!
empty
(
$
buffer
)){
continue
;
}
}
break
;
}
}
?>
Back
|
FazBrowse Home
|
New Git URL