In this article, you will learn how to create buffer for file in PHP. The set_file_buffer() function in PHP specifies the number of bytes to buffer on the given file.
what is the syntax of the SET_FILE_BUFFER function in php?
set_file_buffer(file, buffer)
Parameter | Description |
---|---|
file | Required. Specifies a file pointer |
buffer | Required. Specifies the number of bytes to buffer |
examples of the SET_FILE_BUFFER function
Example 1. In this example, we create an unbuffered stream.
<?php
$file = fopen("test.txt","w");
if ($file) {
set_file_buffer($file,0);
fwrite($file,"Hello World. Testing!");
fclose($file);
}
?>