HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

stream_set_chunk_size

Description

The stream_set_chunk_size of Stream for PHP set the stream chunk size.

Syntax

stream_set_chunk_size ( resource $fp , int $chunk_size ) : int

Parameters

fp

The target stream.

chunk_size

The desired new chunk size.

Return

Returns the previous chunk size on success. Will return FALSE if chunk_size is less than 1 or greater than PHP_INT_MAX.

Examples

1

<?

$filename = "https://osbo.com";
$mode = "rb";

$fp = fopen($filename, $mode);

    $chunk_size = 1024;

    $return = stream_set_chunk_size($fp, $chunk_size);

    echo $return;

    while (!feof($fp))
    {
        fgets($fp);
    }

fclose($fp);
8192