php8.5
Home/ Manual/ stream / functions/ stream_set_chunk_size

stream_set_chunk_size

PHP function Edit on GitHub ✎

(PHP 5 >= 5.4.0, PHP 7, PHP 8)

Set the stream chunk size

Description

stream_set_chunk_size(resource $stream, int $size): int

Set the stream chunk size.

Parameters

stream

The target stream.

size

The desired new chunk size.

Return Values

Returns the previous chunk size on success.

Errors/Exceptions

A ValueError is thrown if size is less than 1 or greater than PHP_INT_MAX.

Changelog

VersionDescription
8.0.0A 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.

Source: reference/stream/functions/stream-set-chunk-size.xml · from the official PHP manual (php/doc-en)