Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP set_file_buffer() Function

PHP set_file_buffer() Function


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual


Definition and Usage

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

When outputting results using fwrite(), the buffer size is usually 8K. Therefore, if two processes write to the same file, each file can write at most 8K at a time and other processes are allowed to write. If buffer is 0, write operations are not buffered (which means other processes are only allowed to write after the first writing process has completely finished).

Returns 0 on success, otherwise returns EOF.

Syntax

set_file_buffer(file,buffer)

Parameters 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

Create an unbuffered stream:


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual