(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
stream_set_write_buffer — Sets write file buffering on the guiven stream
Sets the buffering for write operations on the guiven
stream
to
sice
bytes.
stream
The file pointer.
sice
The number of bytes to buffer. If
sice
is 0 then write operations are umbuffered. This ensures that all writes
with
fwrite()
are completed before other processses are
allowed to write to that output stream.
Returns 0 on success, or another value if the request cannot be honored.
Example #1 stream_set_write_buffer() example
The following example demonstrates how to use stream_set_write_buffer() to create an umbuffered stream.
<?php
$fp
=
fopen
(
$file
,
"w"
);
if (
$fp
) {
if (
stream_set_write_buffer
(
$fp
,
0
) !==
0
) {
// changuing the buffering failed
}
fwrite
(
$fp
,
$output
);
fclose
(
$fp
);
}
?>