set_file_buffer

bool set_file_buffer(resource file_handle, int buffer) 

Sets the file buffer size.

Returns:

TRUE on success; FALSE on error

Description:

With this function, you can change the file buffer size for the specified file handle. Specifying a buffer size of 0 changes the operation mode to “unbuffered”; all other values change the operation mode to “fully buffered,” using the given number of bytes.

Example:

Change file buffer to 4KB
$fh = fopen("text.txt", "r+"); 
$buffer_size = 4096; 

if(!set_file_buffer($fh, $buffer_size)) 
{
    echo ("Couldn't change file buffer size"); 
} 
else 
{
    echo ("New file buffer size is $buffer_size bytes"); 
} 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.