stream_set_read_buffer()
stream_set_read_buffer() — Set read file buffering on the given stream.
Built-in function of PHP 8.5. The manual lists it as available in PHP 5 >= 5.3.3, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
Sets the read buffer. It's the equivalent of stream_set_write_buffer(), but for read operations.
Signature
stream_set_read_buffer(resource $stream, int $size): int
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $stream | resource | The file pointer. |
| $size | int | The number of bytes to buffer. If size is 0 then read operations are unbuffered. This ensures that all reads with fread() are completed before other processes are allowed to read from that input stream. |
Return value
Returns 0 on success, or another value if the request cannot be honored.
Example
The PHP manual ships no example for stream_set_read_buffer(); the signature and the parameter table above are the contract.
See also
All PHP 8.5 built-in functions
Reference card built from the PHP manual page stream_set_read_buffer() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.