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

stream_set_write_buffer

Description

The stream_set_write_buffer of Stream for PHP sets write file buffering on the given stream.

Syntax

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

Parameters

stream

The file pointer.

size

The number of bytes to buffer.

If size is 0 then write operations are unbuffered. This ensures that all writes with fwrite() are completed before other processes are allowed to write to that output stream.

Return

Returns 0 on success, or another value if the request cannot be honored.

Examples

1 · stream size

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';
$mode = 'w';

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

    $size = 1024;

    $return = stream_set_write_buffer($stream, $size);

    echo $return;

    $data = 'hello';

    fwrite($stream, $data);

fclose($stream);

?>
-1
HomeMenu