← All built-ins / stream_recv()

stream_recv()

stream_recv(...$args): string

Parameters

NameTypeDescription
$sockresourcesocket handle
$maxintmaximum bytes (default 4096, max 1 MiB)optional

Return value

Received bytes as a string ("" when nothing arrived).

Example

echo "used in registry/server.hphp and lib/websocket.hphp";
used in registry/server.hphp and lib/websocket.hphp

This call needs a real environment (window, server, database or stdin) — the snippet above shows the typical usage shape.

See also

stream_send()stream_eof()