stream_set_chunk_size()
stream_set_chunk_size() — Set the stream chunk size.
Built-in function of PHP 8.5. The manual lists it as available in PHP 5 >= 5.4.0, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
Signature
stream_set_chunk_size(resource $stream, int $size): int
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $stream | resource | The target stream. |
| $size | int | The desired new chunk size. |
Return value
Returns the previous chunk size on success.
Example
The PHP manual ships no example for stream_set_chunk_size(); the signature and the parameter table above are the contract.
Changelog
| Version | Change |
|---|---|
| 8.0.0 | A ValueError is now thrown if size is less than 1 or greater than PHP_INT_MAX. Previously, an E_WARNING level error was emitted and false was returned. |
All PHP 8.5 built-in functions
Reference card built from the PHP manual page stream_set_chunk_size() (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.