The set_file_buffer() function sets the buffer size of an open file.
This function is an alias of stream_set_write_buffer().
PHP set_file_buffer() Function has the following syntax.
set_file_buffer(file,buffer)
Parameter | Is Required | Description |
---|---|---|
file | Required. | Open file |
buffer | Required. | Buffer size in bytes |
This function returns 0 on success, otherwise it returns EOF.
Create an unbuffered stream:
<?php
$file = fopen("test.txt","w");
if ($file){
set_file_buffer($file,0);
fwrite($file,"Hello World. Testing!");
fclose($file);
}
?>