fread
reactphp/event-loop
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Binary-safe file read
fread
(
resource $stream
,
int $length
):
string
|
false
Loop
::
addReadStream
(
STDIN
, function (
$stream
) {
$chunk
=
fread
(
$stream
,
64
*
1024
);
if (
$chunk
===
''
) {
examples/11-consume-stdin.php
Loop
::
addReadStream
(
$stream
, function (
$stream
) {
$chunk
=
fread
(
$stream
,
64
*
1024
);
if (
$chunk
===
''
) {
examples/13-http-client-blocking.php
Loop
::
addReadStream
(
$stream
, function (
$stream
) {
$chunk
=
fread
(
$stream
,
64
*
1024
);
if (
$chunk
===
''
) {
examples/14-http-client-async.php
$loop
=
$this
->
loop
;
$received
=&
$this
->
received
;
$loop
->
addReadStream
(
$output
, function (
$output
) use (
$loop
, &
$received
) {
$chunk
=
fread
(
$output
,
1024
);
if (
$chunk
===
''
) {
$received
.=
'X'
;
$loop
->
removeReadStream
(
$output
);
tests/AbstractLoopTest.php
$loop
=
$this
->
loop
;
$loop
->
addReadStream
(
$stream
, function (
$stream
) use (
$loop
) {
$data
=
fread
(
$stream
,
1024
);
if (
$data
!==
''
) {
return;
}
tests/AbstractLoopTest.php