Easy Tutorial
❮ Func Math Tanh Func Filesystem Fgetcsv ❯

PHP set_file_buffer() Function



Definition and Usage

The set_file_buffer() function sets the buffer size for an open file.

When using the fwrite() function to output results, the buffer size is typically 8K. Therefore, if two processes are writing to the same file, each process can write a maximum of 8K at a time, allowing other processes to write as well. If the buffer is set to 0, no buffering will be applied to the write operations (this means: no other process can write until the first writing process is completely finished).

The function returns 0 on success, otherwise it returns EOF.

Syntax

Parameter Description
file Required. Specifies the open file.
buffer Required. Specifies the buffer size in bytes.

Tips and Notes

Tip: This function is an alias of stream_set_write_buffer().


Example

Creating a stream with no buffering:


❮ Func Math Tanh Func Filesystem Fgetcsv ❯